404重定向到多个错误页面htaccess

时间:2014-06-13 05:45:51

标签: .htaccess

我有两个网址

/web/20110606105658/
/about-us/AwardDetails.aspx?AWDID=1

我必须在htaccess中为URL设置不同的404错误页面

离。
    /web/20110606105658/应该转到www.google.com     /about-us/AwardDetails.aspx?AWDID=1应该转到www.yahoo.com

1 个答案:

答案 0 :(得分:0)

您需要对此404处理使用mod_rewrite规则:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^web/20110606105658/?$ http://www.google.com/ [L,NC,R=301]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{QUERY_STRING} ^AWDID=1$ [NC]
RewriteRule ^about-us/AwardDetails\.aspx$ http://www.yahoo.com/ [L,NC,R=301]