0

This one is driving me crazy. Whatever I do, it doesn't say the page is GONE. Full url will be something like: example.com/product_detail.php?id=18

I want to give every page that starts with product_details.php the status GONE.

I thought that one of these would work, but no luck

RewriteRule ^product_detail - [G]
RewriteRule ^product_detail.php?id=(.*)$ - [G]

Any help appreciated.

4

2 回答 2

0

您是否测试过该规则是否适用?这对我有用:

重写规则 ^product_detail.*$ - [G]

您是否在 .htaccess 文件中启用了 RewriteEngine?(假设这就是你正在使用的)

apache中的重写模块是否打开?是否允许在给定位置?

于 2013-10-24T00:14:24.253 回答
0

根据 John Lin 的评论,我将 RewriteRule 移到了 htaccess 的顶部,然后它就可以工作了。进一步的测试表明,当我将 RewriteRule 放在 Wordpress 的基本行之下时

# 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

它不起作用,但是当它在这些行之前它起作用。今天学了点儿新东西。

希望对其他人也有帮助。

于 2013-10-24T00:21:06.690 回答