【发布时间】:2014-01-25 20:50:32
【问题描述】:
我在这里和其他地方查看了无数答案,但没有找到我真正需要的答案。我正在使用旧的 Joomla 1.5 网站,而不是根据所有者的具体要求使用 SEF。但我希望所有非 www 请求都被重写为 www,除了特定的表单/付款页面。
Example:
http://domain.com/index.php?option=com_content&view=article&id=43&Itemid=11
becomes
http://www.domain.com/index.php?option=com_content&view=article&id=43&Itemid=11
except a payment page
http://domain.com/index.php?option=com_rsform&formId=3
or
http://www.domain.com/index.php?option=com_rsform&formId=3
becomes
https://domain.com/index.php?option=com_rsform&formId=3
我正在使用此代码:
RewriteEngine On
########## Begin - Redirect non-https non-www to www
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=302,L]
########## End - Redirect non-www to www
只要他们坚持我指向付款页面的链接,我就可以到达那里,但我想确保它是万无一失的。并更好地了解如何做到这一点。我可能已经厌倦了一百种不同的规则 - 我正在尝试学习正则表达式问题,但无法及时为我的客户提供它。
我可以在任何形式上使用它,因此“option=com_rsform”将始终在 url 中。我不知道在制定条件时是否将其视为字符串或变量..无论如何我非常感谢建议的解决方案。
【问题讨论】:
标签: regex .htaccess mod-rewrite joomla