将 URL 与 HTaccess 匹配某些字符串,但不匹配其他字符串
我已经尝试解决这个问题有一段时间了。我已成功将两位数子文件夹(即语言文件夹)中的所有 URL 引用回主站点。所以我得到了这样的 URL:
http://www.mysite.com/de/index.php&option=com_virtuemart&page=shop.browse&category_id=&product_type_id=1&product_type_1。 ..etc
前往
http://www.mysite.com/index.php&option=com_virtuemart&page=shop.browse&category_id=&product_type_id=1&product_type_1...etc< /code>
使用此 HTacess 行:
RedirectMatch 301 /../(.*)index.php(.*)$ http://www.mysite.com/$1
这很好,直到最近我添加了一个附属系统,该系统的网址以index.php开头,我想制作这个组件免除重写规则。
总之,我希望能够创建一个与 URL 匹配的规则或匹配,例如:
http://www.mysite.com/de/index.php&option=com_virtuemart&page=shop.browse& category_id=&product_type_id=1&product_type_1...etc
但与以下网址不匹配:
http://www.mysite.com/de/index.php?option=com_affiliate
和 http://www.mysite.com/de/index.php?option=com_affiliate&sec=banners
感谢您花时间阅读本文。蚂蚁。
以下是我的 HTaccess 文件的链接:http://www.seed-city.com/htaccess。文本
I've been trying to figure this problem out for a while now. I've succeeded in referring all URLs from a two digit subfolder (ie the language folders) back to the main site. So I've got these a URL like this:
http://www.mysite.com/de/index.php&option=com_virtuemart&page=shop.browse&category_id=&product_type_id=1&product_type_1...etc
going to
http://www.mysite.com/index.php&option=com_virtuemart&page=shop.browse&category_id=&product_type_id=1&product_type_1...etc
using this HTacess line:
RedirectMatch 301 /../(.*)index.php(.*)$ http://www.mysite.com/$1
This was fine until recently when I've added an affiliate system which has urls starting with index.php and I'd like to make this component exempt from the rewrite rule.
In Summary, I'd like to be able to create a rule or match that matched URLs like :
http://www.mysite.com/de/index.php&option=com_virtuemart&page=shop.browse&category_id=&product_type_id=1&product_type_1...etc
but didn't match URLs like:
http://www.mysite.com/de/index.php?option=com_affiliate
andhttp://www.mysite.com/de/index.php?option=com_affiliate&sec=banners
Thanks for your time in reading this. Ant.
Here is a link to my HTaccess file: http://www.seed-city.com/htaccess.txt
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
mod_rewrite
您可以执行以下操作:希望有所帮助。
Using
mod_rewrite
you can do the following:Hope that helps.