2017-02-08 54 views
0

我被要求在已开发的ExpressionEngine网站上提供帮助。还有的是,重写任何现有的.htaccess文件不是一个文件或目录,使其通过的index.php云:Apache rewrite/product/to/products /和index.php

RewriteEngine On 
RewriteBase/
# Not a file or directory (also catches index.php) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /index.php?$1 [L] 

这工作得很好,并举例URL可能是:

WWW .mysite.com /产品/富(复数“产品”)

然而,它还需要处理旧网址,这将是形式:

www.mysite.com/product/foo(单数'product')

我已经试过如下:

RewriteEngine On 
RewriteBase/
# Not a file or directory (also catches index.php) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^product/(.+) /index.php/products/$1 [L] 
RewriteRule ^(.*)$ /index.php?$1 [L] 

希望,如果它发现“产品”,然后将其重写为“产品”通过index.php文件,然后退出,但它不工作。

与此同时,我需要启动任何输入网址:

/部门/富 被改写为:

/部门/分类/富

greatefully收到任何帮助。

+0

保持平均每个职位的一个问题。 – anubhava

回答

1

您可以使用添加规则您现有的规则上面映射product -> products

RewriteEngine On 
RewriteBase/

RewriteRule ^product(/.*)?$ products$1 [L,NC] 

# Not a file or directory (also catches index.php) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /index.php?$1 [L]