2013-07-17 121 views
1

2目錄名我需要重寫或重定向的URL是這樣的:刪除/重寫從URL

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

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

和htaccess在我店(Magento)導演y已經有這個:

<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?

回答

1

插入這條線僅低於RewriteBase行:

RewriteRule ^product/(.+)$ /$1 [L,R=302,NC] 
+0

是的,這工作!你看起來很簡單。 ;) –

+0

不客氣,很高興它解決了問題。 – anubhava