2014-05-06 99 views
0

我在那里我试图消除某些网址中的子目录的情况下删除子目录。mod_rewrite的某些网址中

这里就是我试图完成

http://www.example.com/shop/some_product应该去http://www.example.com/some_product

我需要http://www.example.com/shop/customer/account保持不变。

所以基本上我需要重写任何店/ ...除了店/客户/ ...店/管理/...

这是我曾尝试

RewriteCond %{REQUEST_URI} !^/shop/customer 
RewriteCond %{REQUEST_URI} !^/shop/admin 
RewriteCond %{REQUEST_URI} !^/shop/sales 
RewriteRule ^/shop/(.*) http://www.example.com/$1 [L] 

任何人有什么建议吗?

+0

看起来不错,只是你缺少初始'RewriteEngine叙述on'。 – arkascha

+0

并且'RewriteRule'中的前导斜杠'^ /'是否正确取决于放置该规则的_where_。 – arkascha

回答

0

感谢arkascha。

原来我有一对夫妇的问题。以下是我结束了:在/shop/.htaccess

RewriteCond %{REQUEST_URI} !^/shop/(media|skin|js|customer|admin|sales|checkout)/ 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*) /$1 [L] 

我需要不重写URL匹配的文件或目录

。另外,似乎有/ shop /是RewriteCond的必需条件,但在RewriteRule中不起作用。