1
我想根據用戶代理將用戶重定向到特定網站。.htaccess - 500內部服務器錯誤
現在我的.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
的Apache的版本什您使用的是? – starkeen
apache/2.2.31(Unix)mod_ssl/2.2.31在centos上6.7 我剛剛讀過那個elseif等僅僅是2.4的可用。是否有2.4 apache版本可用於centos 6.7? – Salexes
如果elseif指令在Apache 2.4及更高版本中可用,則不在2.2中。 – starkeen