本文介绍了为什么我的htaccess规则不重写网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好的,所以我在我的opencart应用程序中有这个网址,并且效果很好
Ok so i have this url in my opencart application and it works well
site/index.php?route=information/contact但客户讨厌该网址并想要
but the clients hates the url and wants
site/contact我认为我可以在htaccess中执行此操作,一切都会很好,但是访问url却一无所获
i figured i could just do this in my htaccess and all would be good but visiting the url i get nothing
RewriteRule ^(contact)$ index.php?route=information/contact [L,QSA]任何想法
这是我的努力
RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA] RewriteRule ^contact$ /index.php?route=information/contact [L,QSA]推荐答案
删除括号
RewriteRule ^contact$ index.php?route=information/contact [L,QSA]您的.htaccess文件应如下所示:
your .htaccess should look like:
RewriteEngine On RewriteBase / RewriteRule ^contact$ /index.php?route=information/contact [L,QSA] RewriteCond %{REQUEST_URI} !^/contact$ RewriteRule ^([^?]*) index.php?route=$1 [L,QSA]更多推荐
为什么我的htaccess规则不重写网址
发布评论