.htaccess上的坏旗分隔符

时间:2014-10-10 09:43:08

标签: apache .htaccess

我已将以下内容输入到我的.htaccess中,并且我遇到了可怕的坏标记分隔符错误。我已经尝试过验证器了,有人说它是第5行和第7行,另一行是所有其他行。

任何帮助都将不胜感激。

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /index.php HTTP/
RewriteRule ^index.php$ http://www.example.com/ [R=301,L]
RewriteCond %{QUERY_STRING} ^source= RewriteRule (.*) /$1? [R=301,L]
RewriteRule ^category/([^/.]+)/?$ category.php?id=$1 [L]
RewriteRule ^business/([^/.]+)/?$ business.php?id=$1 [L]
RewriteRule ^event/([^/.]+)/?$ event.php?id=$1 [L]

1 个答案:

答案 0 :(得分:0)

不允许空间未转义。试试这段代码:

Options +FollowSymLinks
RewriteEngine on

RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index.php\ HTTP/
RewriteRule ^index.php$ / [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /category.php\?id=([^&\ ]+) HTTP/
RewriteRule ^ /category/$1? [R=301,L]

RewriteCond %{QUERY_STRING} ^source=
RewriteRule (.*) /$1? [R=301,L]

RewriteRule ^category/([^/.]+)/?$ category.php?id=$1 [L]

RewriteRule ^business/([^/.]+)/?$ business.php?id=$1 [L]

RewriteRule ^event/([^/.]+)/?$ event.php?id=$1 [L]