【发布时间】:2014-02-15 17:58:11
【问题描述】:
谁能帮我获得正确的 .htaccess 规则:
重定向这个特定的ID url:
http://www.domain.com/watch.php?id=00000000001
到我的 404 错误页面:
http://www.domain.com/404/
【问题讨论】:
标签: .htaccess redirect http-status-code-404 dynamic-url
谁能帮我获得正确的 .htaccess 规则:
重定向这个特定的ID url:
http://www.domain.com/watch.php?id=00000000001
到我的 404 错误页面:
http://www.domain.com/404/
【问题讨论】:
标签: .htaccess redirect http-status-code-404 dynamic-url
在您的 DOCUMENT_ROOT/.htaccess 文件中使用此规则:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^id=00000000001$ [NC]
RewriteRule ^watch\.php$ /404/? [NC,L,R=301]
【讨论】:
RewriteCond %{REQUEST_URI} ^/watch\.php$ RewriteCond %{QUERY_STRING} ^id=00000000001$ RewriteRule ^(.*)$ http//www.domain.com/404/ [L,R=301]