【发布时间】:2012-12-19 08:08:47
【问题描述】:
我有一个不再使用日历组件的 Joomla 站点,我需要将所有旧 URL 重定向回主页。 URL 看起来像这样...
http://www.example.com/week/?date=2006-03-05&print=1&tmpl=component
http://www.example.com/week/?date=2010-09-12
http://www.example.com/week/?date=2007-04-01&print=1&tmpl=component
我尝试在 .htaccess 文件中编写 RedirectMatch 以删除域之后的所有内容,但我只能从 URL 中删除 week/,问号和参数仍然存在。这会导致某些参数出现问题,这些参数会删除模板、模块或格式化页面以进行打印。
谁能提出解决方案?这是我迄今为止尝试过的......
RedirectMatch 301 ^/week/\?.* http://www.example.com
RedirectMatch 301 ^/week/\?(.*) http://www.example.com
RedirectMatch 301 ^/week/\?+.+ http://www.example.com
RedirectMatch 301 ^/week/\?+(.*) http://www.example.com
同样的规则没有插入符号...
RedirectMatch 301 /week/\?.* http://www.example.com
RedirectMatch 301 /week/\?(.*) http://www.example.com
RedirectMatch 301 /week/\?+.+ http://www.example.com
RedirectMatch 301 /week/\?+(.*) http://www.example.com
【问题讨论】:
标签: regex .htaccess redirect joomla