Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下网址:
www.domain.com/test/blog/index.html
我希望 apache 始终重写 url,以便删除“test”,从而导致:
www.domain.com/blog/index.html
最好的方法是什么?
这应该做得很好
Options +FollowSymLinks RewriteEngine on RewriteCond %{REQUEST_URI} !(.*)test RewriteRule ^(.*)$ test/$1 [L]
这将从您指定的 url 中删除子目录;似乎您遇到的任何其他问题都与.htaccess文件中的其他内容有关,这些内容弄乱了符号链接。
.htaccess
我建议查看 Apache 错误日志以准确指出错误是什么。
希望这可以帮助。