我想做一个简单的.htaccess
重定向,但我无法使其正常工作。
RewriteEngine On
Redirect about.html article.php?id=about [L]
脚本和.htaccess
位于子目录中:domain.tld/directory/
我的错误在哪里?
答案 0 :(得分:1)
您正在混合mod_alias和mod_rewrite的规则,
如果您只想在directory/
,
RewriteEngine On
RewriteRule ^about.html$ article.php?id=about [R=301]
如果你想重写,假设about.html不存在。
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^about.html$ article.php?id=about [L]