.htaccess Joomla 3没有重定向301非sef

时间:2013-05-31 08:36:49

标签: .htaccess joomla

我使用Joomla 3.1重新设计Joomla 1.5网站,由于新的菜单结构,我不得不重定向很多网址。

我已经在.htaccess文件中创建了重定向301但它只重定向了SEF网址 - 我怎么做或者我做错了什么......

确实重定向:

Redirect 301 /about-us/sailing-team/16-company.html http://www.endeavoursailing.co.uk/about-us/sailing-team.html

它没有重定向:

Redirect 301 /?format=html&tmpl=component&phocadownload=1&catid=0&id=41 http://www.endeavoursailing.co.uk/impressions/photo-gallery.html

感谢您的帮助

2 个答案:

答案 0 :(得分:2)

重定向GET请求的最常见问题是参数的顺序与请求本身无关,但它对重定向比较很重要。所以,对于Joomla !,参数

format=html&tmpl=component

tmpl=component&format=html

是等价的,但对于.htaccess重定向,它们是不同的。

另一件事是你的网址包含catid=0 - 但很可能没有这样的类别,因为ids是整数。

答案 1 :(得分:0)

启用mod_rewrite后,将“cond,rule”对添加到.htaccess文件中,例如:

RewriteCond %{QUERY_STRING} ^option=com_content\&view=category\&layout=blog\&id=10\&Itemid=4$
RewriteRule index.php  /pageOne? [R=301,L]

RewriteCond %{QUERY_STRING} ^_query_string_$
RewriteRule index.php  /pageTwo? [R=301,L]

第一个示例将重定向: /index.php?option=com_content&view=category&layout=blog& ...
to:/ pageOne
“?”在“/ pageOne?”删除查询参数。

必须转义的字符是:“。\ + *?[^] $(){} =!<> |: - ”

详情请见:php escape special chars in regex