1

我需要像这样重写或重定向 URL:

http://www.mydomain.com/shop/product/keep-this-please

http://www.mydomain.com/keep-this-please

我的商店(Magento)目录中的 htaccess 已经有了这个:

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on
    RewriteBase /shop/

## always send 404 on missing files in these folders
    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

## never rewrite for existing files, directories and links
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l

## rewrite everything else to index.php
    RewriteRule .* index.php [L]
</IfModule>

如何仅重写带有 /shop/product/ 的 URL?

4

1 回答 1

1

在 RewriteBase 行下方插入这一行:

RewriteRule ^product/(.+)$ /$1 [L,R=302,NC]
于 2013-07-18T07:35:36.590 回答