使 htaccess opencart mod_rewrite 工作

make htaccess opencart mod_rewrite work

我正在尝试重写

http://valencia/vazi/brand-cristal-de-parishttp://valencia/vazi/?brand=cristal-de-paris

这是我的规则: RewriteRule (.*)/brand-(.*)/? //?brand= [L,QSA]

但我被重定向到 http://valencia/vazi/?brand=cristal-de-paris 因为 opencart 规则:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_= [L,QSA]

所以重定向是问题所在...我只需要工作 url http://valencia/vazi/brand-cristal-de-paris 没有重定向

rewrite.log: https://www.valencia.com.ua/rewrite.log

谢谢!

更新:

我将规则修改为:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)/(brand-)*(.*)/? index.php?_route_=/&brand= [L,QSA]

但我也得到了重定向...

重写日志:

[Mon Mar 13 12:55:20.316081 2017] [rewrite:trace3] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e3ff50/initial] [perdir C:/Z-WWW/valencia/] add path info postfix: C:/Z-WWW/valencia/vazi -> C:/Z-WWW/valencia/vazi/brand-cristal-de-paris
[Mon Mar 13 12:55:20.316081 2017] [rewrite:trace3] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e3ff50/initial] [perdir C:/Z-WWW/valencia/] strip per-dir prefix: C:/Z-WWW/valencia/vazi/brand-cristal-de-paris -> vazi/brand-cristal-de-paris
[Mon Mar 13 12:55:20.316081 2017] [rewrite:trace3] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e3ff50/initial] [perdir C:/Z-WWW/valencia/] applying pattern '(.*)/(brand-)*(.*)/?' to uri 'vazi/brand-cristal-de-paris'
[Mon Mar 13 12:55:20.317081 2017] [rewrite:trace4] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e3ff50/initial] [perdir C:/Z-WWW/valencia/] RewriteCond: input='C:/Z-WWW/valencia/vazi' pattern='!-f' => matched
[Mon Mar 13 12:55:20.317081 2017] [rewrite:trace4] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e3ff50/initial] [perdir C:/Z-WWW/valencia/] RewriteCond: input='C:/Z-WWW/valencia/vazi' pattern='!-d' => matched
[Mon Mar 13 12:55:20.317081 2017] [rewrite:trace2] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e3ff50/initial] [perdir C:/Z-WWW/valencia/] rewrite 'vazi/brand-cristal-de-paris' -> 'index.php?_route_=vazi/&brand=cristal-de-paris'
[Mon Mar 13 12:55:20.317081 2017] [rewrite:trace3] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e3ff50/initial] split uri=index.php?_route_=vazi/&brand=cristal-de-paris -> uri=index.php, args=_route_=vazi/&brand=cristal-de-paris
[Mon Mar 13 12:55:20.317081 2017] [rewrite:trace3] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e3ff50/initial] [perdir C:/Z-WWW/valencia/] add per-dir prefix: index.php -> C:/Z-WWW/valencia/index.php
[Mon Mar 13 12:55:20.317081 2017] [rewrite:trace2] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e3ff50/initial] [perdir C:/Z-WWW/valencia/] trying to replace prefix C:/Z-WWW/valencia/ with /
[Mon Mar 13 12:55:20.317081 2017] [rewrite:trace5] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e3ff50/initial] strip matching prefix: C:/Z-WWW/valencia/index.php -> index.php
[Mon Mar 13 12:55:20.317081 2017] [rewrite:trace4] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e3ff50/initial] add subst prefix: index.php -> /index.php
[Mon Mar 13 12:55:20.317081 2017] [rewrite:trace1] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e3ff50/initial] [perdir C:/Z-WWW/valencia/] internal redirect with /index.php [INTERNAL REDIRECT]
[Mon Mar 13 12:55:20.317081 2017] [rewrite:trace3] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e509a0/initial/redir#1] [perdir C:/Z-WWW/valencia/] strip per-dir prefix: C:/Z-WWW/valencia/index.php -> index.php
[Mon Mar 13 12:55:20.317081 2017] [rewrite:trace3] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e509a0/initial/redir#1] [perdir C:/Z-WWW/valencia/] applying pattern '(.*)/(brand-)*(.*)/?' to uri 'index.php'
[Mon Mar 13 12:55:20.317081 2017] [rewrite:trace1] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e509a0/initial/redir#1] [perdir C:/Z-WWW/valencia/] pass through C:/Z-WWW/valencia/index.php
[Mon Mar 13 12:55:20.419087 2017] [rewrite:trace3] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e4dfc0/initial] [perdir C:/Z-WWW/valencia/] add path info postfix: C:/Z-WWW/valencia/vazi -> C:/Z-WWW/valencia/vazi/
[Mon Mar 13 12:55:20.419087 2017] [rewrite:trace3] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e4dfc0/initial] [perdir C:/Z-WWW/valencia/] strip per-dir prefix: C:/Z-WWW/valencia/vazi/ -> vazi/
[Mon Mar 13 12:55:20.419087 2017] [rewrite:trace3] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e4dfc0/initial] [perdir C:/Z-WWW/valencia/] applying pattern '(.*)/(brand-)*(.*)/?' to uri 'vazi/'
[Mon Mar 13 12:55:20.419087 2017] [rewrite:trace4] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e4dfc0/initial] [perdir C:/Z-WWW/valencia/] RewriteCond: input='C:/Z-WWW/valencia/vazi' pattern='!-f' => matched
[Mon Mar 13 12:55:20.419087 2017] [rewrite:trace4] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e4dfc0/initial] [perdir C:/Z-WWW/valencia/] RewriteCond: input='C:/Z-WWW/valencia/vazi' pattern='!-d' => matched
[Mon Mar 13 12:55:20.419087 2017] [rewrite:trace2] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e4dfc0/initial] [perdir C:/Z-WWW/valencia/] rewrite 'vazi/' -> 'index.php?_route_=vazi/&brand='
[Mon Mar 13 12:55:20.419087 2017] [rewrite:trace3] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e4dfc0/initial] split uri=index.php?_route_=vazi/&brand= -> uri=index.php, args=_route_=vazi/&brand=&brand=cristal-de-paris
[Mon Mar 13 12:55:20.419087 2017] [rewrite:trace3] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e4dfc0/initial] [perdir C:/Z-WWW/valencia/] add per-dir prefix: index.php -> C:/Z-WWW/valencia/index.php
[Mon Mar 13 12:55:20.419087 2017] [rewrite:trace2] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e4dfc0/initial] [perdir C:/Z-WWW/valencia/] trying to replace prefix C:/Z-WWW/valencia/ with /
[Mon Mar 13 12:55:20.419087 2017] [rewrite:trace5] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e4dfc0/initial] strip matching prefix: C:/Z-WWW/valencia/index.php -> index.php
[Mon Mar 13 12:55:20.419087 2017] [rewrite:trace4] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e4dfc0/initial] add subst prefix: index.php -> /index.php
[Mon Mar 13 12:55:20.419087 2017] [rewrite:trace1] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e4dfc0/initial] [perdir C:/Z-WWW/valencia/] internal redirect with /index.php [INTERNAL REDIRECT]
[Mon Mar 13 12:55:20.419087 2017] [rewrite:trace3] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e40788/initial/redir#1] [perdir C:/Z-WWW/valencia/] strip per-dir prefix: C:/Z-WWW/valencia/index.php -> index.php
[Mon Mar 13 12:55:20.419087 2017] [rewrite:trace3] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e40788/initial/redir#1] [perdir C:/Z-WWW/valencia/] applying pattern '(.*)/(brand-)*(.*)/?' to uri 'index.php'
[Mon Mar 13 12:55:20.419087 2017] [rewrite:trace1] [pid 2524:tid 868] mod_rewrite.c(477): [client 127.0.0.1:62147] 127.0.0.1 - - [valencia/sid#ce1ad8][rid#1e40788/initial/redir#1] [perdir C:/Z-WWW/valencia/] pass through C:/Z-WWW/valencia/index.php

请帮忙...

问题出在 opencart SeoPro 模块中,该模块进行了重定向...