htaccess无法正常工作,有更多斜线的子网址

问题描述:

我有2个网站。说它5p_fronthttp://localhost/5p_front/)和5p_grouphttp://localhost/5p_group/)(在OctoberCMS开发)(在开发CakePHP的htaccess无法正常工作,有更多斜线的子网址

5p_front我有一个的.htaccess文件和我为这一个条件将重定向到5p_group网站,只要它发现一个单词有5p_group_login在网址中。这里是低于

的.htaccess

RewriteRule ^5p_group_login.*$ http://localhost/5p_group [L,R=301] 

代码所以,如果有人试图去这里例如http://localhost/5p_front/5p_group_login,他们会简单地被重定向到这里http://localhost/5p_group/

从主页和其他页面例如http://localhost/5p_front/we-are-5p-group可以很好地工作。

但是我有一个产品内页http://localhost/5p_front/product/10如果我将鼠标悬停在菜单项,让我重定向到登录页面,其显示的URL http://localhost/5p_front/product/5p_group_login因此,当我点击它,我不能在http://localhost/5p_group/为重定向它只是recirecting到这个目前的网址只有http://localhost/5p_front/product/5p_group_login不应该是这种情况。

此外,我的菜单是动态快到了,我已经使用Static Pages插件创建菜单,这些菜单OctoberCMS提供和我创建像下面“登录”菜单链接。

enter image description here

我如何可以重定向URL在http://localhost/5p_group/即使用户是在http://localhost/5p_front/product/10和“登录”链接点击该图是http://localhost/5p_front/product/5p_group_login如果我鼠标悬停时就可以了。

有人可以指导我在这里我应该怎么做在这种情况下。

感谢

您的规则

RewriteRule ^5p_group_login.*$ http://localhost/5p_group [L,R=301] 

放在5p_front/.htaccess时,只会影响到与/5p_front/5p_group_login(因为在你的模式领先^的),所以/5p_front/product/5p_group_login不匹配开头的URI。

如果你想重写有5p_group_login anyhwere的网址,只需使用:

RewriteRule 5p_group_login http://localhost/5p_group [L,R=301] 
+0

哇..很好的解释。谢谢。 –