1

我更改了 .htacess 文件,如下所示。

RewriteCond %{REQUEST_URI} (.*)product-list.php(.*)
RewriteRule (.*) www.example.com/swimming-pool/product-list\.php$1 [R=301,L]
RewriteCond %{REQUEST_URI} (.*)product-info.php(.*)
RewriteRule (.*)\?(.*)$ www.example.com/swimming-pool/product\-info\.php$2 [R=301,L]

当我请求时,我只需要那个

http://www.example.com/product-info.php?Applepc.html应该重定向到

http://www.example.com/swimming-pool/product-info.php?Applepc.html

URL 字段中的输出是这样的:-

www.example.com/swimming-pool/product-list.phpswimming-pool/product-list.phpswimming-pool/product-list.phpswimming-pool/product-list.phpswimming-pool/product-list.phpswimming-pool/ product-list.phpswimming-pool/product-list.phpswimming-pool/product-list.phpswimming-pool/product-list.phpswimming-pool/product-list.phpswimming-pool/product-list.phpswimming-pool/product- list.phpswimming-pool/product-list.phpswimming-pool/product-list.phpswimming-pool/product-list.phpswimming-pool/product-list.phpswimming-pool/product-list.phpswimming-pool/product-list。 phpswimming-pool/product-list.phpswimming-pool/product-list.phpproduct-list.php?Flowers-pg1-cid38.html

请告诉我我在哪里弄错了。

4

1 回答 1

1

尽管您没有提到另一条规则的目的是什么product-list.php,但它已包含在此规则集中。

你可以试试这个:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (product-list|product-info)\.php  [NC]
RewriteRule ^(.*)/?$  swimming-pool/$1 [R=301,L]

永久重定向任何这样的 URL

http://www.example.com/product-info.php?query或者

http://www.example.com/product-list.php?query

http://www.example.com/swimming-pool/product-info.php?query或者

http://www.example.com/swimming-pool/product-list.php?query

实际规则的问题似乎是它们正在生成一个循环。

于 2013-01-29T09:13:50.480 回答