【发布时间】:2014-06-30 03:49:54
【问题描述】:
我的服务器上有一个或多个文件,我想暂时或永久地对用户和搜索引擎隐藏,使用.htaccess 将这些页面重定向到404 页面。这意味着任何尝试查看页面的用户或搜索引擎机器人都会看到404 页面。
以下是我添加到 .htaccess 文件中的行,用于将一些文件重定向到 404 页面,但它似乎不起作用:
RedirectMatch 404 antalya_apartment.php?bid=2&page=236
RedirectMatch 404 antalya_apartment.php?bid=3&page=129
这里是.htaccess 代码:
Options +FollowSymLinks +Indexes +MultiViews
RewriteCond %{QUERY_STRING} (^|&)bid=2(&|$)
RewriteCond %{QUERY_STRING} (^|&)page=236(&|$)
RewriteCond %{QUERY_STRING} (^|&)bid=3(&|$)
RewriteCond %{QUERY_STRING} (^|&)page=129(&|$)
RewriteRule ^/antalya_apartment.php?$ http://turkish-property-world.com/ [L,R=404]
【问题讨论】:
-
那么当你转到
<your domain>/antalya_apartment.php?bid=3&page=129时会发生什么? -
奇怪或与
页面仍然显示,我得到一个 HTTP 响应标头状态:HTTP/1.1 200 OK。我所有其他 htaccess RewriteRule 工作正常。
标签: apache .htaccess mod-rewrite redirect