Mod rewrite Apache将example.com/forum重写为example.com/index.php?page=forum
我是一个完全的Apache重写初学者 我想把example.com/forum改成example.com/index.php?page=forum 这是我的重写文件Mod rewrite Apache将example.com/forum重写为example.com/index.php?page=forum,mod-rewrite,Mod Rewrite,我是一个完全的Apache重写初学者 我想把example.com/forum改成example.com/index.php?page=forum 这是我的重写文件 <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^/forum$ index.php?page=forum RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FIL
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^/forum$ index.php?page=forum
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
这应该对你有用。谢谢,但我只想重写/forum,而不是example/foo-bar@nullptr-在这种情况下,您的htaccess是否已经工作?我所能想到的就是在你写的重写规则的末尾加上[L]标志。你可能是对的,其他规则是由wordpress自动生成的,所以我不知道会发生什么on@nullptr-尝试执行此重写规则^/forum$index.php?page=forum[L]。看看这是否有效。这就是有效的-RewriteRule^forum$index.php?page=forum[L]我的问题是我有一个URL处理脚本,它会再次重写URL。谢谢
RewriteRule ^(.*)$ index.php?page=$1