把头发拉过这一头。我有以下.htaccess文件,除了Wordpress的默认设置外,还会执行一些自定义重定向。在我的本地Wamp服务器上进行测试时,它工作正常,但在转移到生产后,我在服务器日志中没有出现RewriteRule: bad flag delimiters
错误,过了一段时间后网站甚至出现了internal server error
任何帮助将不胜感激。提前谢谢!
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^rockford_weddings___welcome\.html$ /wedding/ [R=301,L]
RewriteRule ^blog/?$ /journal/ [R=301,L]
RewriteRule ^blog/(.*)$ /$1 [R=301,L]
RewriteRule ^portraitinvestment/?$ /portraitinvestment\.pdf [R=301,L]
RewriteRule ^weddinginvestment/?$ /weddinginvestment\.pdf [R=301,L]
RewriteRule ^holidaycards2014/?$ /holidaycards2014\.pdf [R=301,L]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
答案 0 :(得分:1)
可能是换行错误或某些字符集。
试试这个:
将您的自定义htaccess内容复制粘贴到某处:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^rockford_weddings___welcome\.html$ /wedding/ [R=301,L]
RewriteRule ^blog/?$ /journal/ [R=301,L]
RewriteRule ^blog/(.*)$ /$1 [R=301,L]
RewriteRule ^portraitinvestment/?$ /portraitinvestment\.pdf [R=301,L]
RewriteRule ^weddinginvestment/?$ /weddinginvestment\.pdf [R=301,L]
RewriteRule ^holidaycards2014/?$ /holidaycards2014\.pdf [R=301,L]
</IfModule>
从服务器