服务器内部错误


500 Internal Server Error

我想根据用户代理将用户重定向到特定的网站。

现在我的。htaccess文件是这样的:

# 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
RewriteCond %{HTTP_USER_AGENT} opera
RewriteCond %{QUERY_STRING} articleid=(?:[0-9]{1,3}|1000)
<If "%{QUERY_STRING} == 'articleid=001'">
RewriteRule ^$ http://m.example.com/ [L,R=302]
</If>
<ElseIf "%{QUERY_STRING} == 'articleid=002'">
RewriteRule ^$ http://m.example2.com/ [L,R=302]
</ElseIf>
<ElseIf "%{QUERY_STRING} == 'articleid=003'">
RewriteRule ^$ http://m.example3.com/ [L,R=302]
</ElseIf>
<ElseIf "%{QUERY_STRING} == 'articleid=004'">
RewriteRule ^$ http://m.example4.com/ [L,R=302]
</ElseIf>
etc...

现在我得到一个500内部服务器错误错误,当它像这样输入。如何修复它使其可行?

regrards最好,salexes

尝试将这些规则更改为传统的mod_rewrite规则语法,并保持重定向在默认WP规则之前:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} opera
RewriteCond %{QUERY_STRING} (^|&)articleid=articleid=001(&|$) [NC]
RewriteRule ^$ http://m.example.com/? [L,R=302]
RewriteCond %{HTTP_USER_AGENT} opera
RewriteCond %{QUERY_STRING} (^|&)articleid=articleid=002(&|$) [NC]
RewriteRule ^$ http://m.example2.com/? [L,R=302]
RewriteCond %{HTTP_USER_AGENT} opera
RewriteCond %{QUERY_STRING} (^|&)articleid=articleid=003(&|$) [NC]
RewriteRule ^$ http://m.example3.com/? [L,R=302]
RewriteCond %{HTTP_USER_AGENT} opera
RewriteCond %{QUERY_STRING} (^|&)articleid=articleid=004(&|$) [NC]
RewriteRule ^$ http://m.example4.com/? [L,R=302]
RewriteRule ^index'.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</IfModule>