我是PHP新手, 我想通过编辑HTACCESS文件将此URL重定向到我的主页www.laroute-angkor.com
这是我想在访问者点击或访问时重定向的网址:
www.laroute-angkor.com/component/k2/item/68-tours-by-sub-categories/68-tours-by-sub-categories?cat_id=23&start=5710 http://www.laroute-angkor.com/component/k2/item/62-bakheng-mountain/62-bakheng-mountain?start=1222270 http://www.laroute-angkor.com/component/k2/item/497-tours-by-sub-categories?cat_id=38 http://www.laroute-angkor.com/component/k2/item/496-tours-by-sub-categories?cat_id=38
答案 0 :(得分:0)
以下内容会将上述所有4个链接重定向到您的索引页。
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteBase /
RewriteCond %{QUERY_STRING} ^cat_id=23&start=5710$
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/68-tours-by-sub-categories/68-tours-by-sub-categories/?$ /? [R=301,NC,L]
RewriteCond %{QUERY_STRING} ^start=1222270$
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/62-bakheng-mountain/62-bakheng-mountain/?$ /? [R=301,NC,L]
RewriteCond %{QUERY_STRING} ^cat_id=38$
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/49(6|7)-tours-by-sub-categories/?$ /? [R=301,NC,L]
注意:如果之后会发生什么?它就像这样并不重要:
Options +FollowSymLinks -MultiViews
RewriteEngine on
RewriteBase /
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/68-tours-by-sub-categories/68-tours-by-sub-categories/?$ /? [R=301,NC,L]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/62-bakheng-mountain/62-bakheng-mountain/?$ /? [R=301,NC,L]
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/49(6|7)-tours-by-sub-categories/?$ /? [R=301,NC,L]
2之间的区别在于第二个会重定向:
http://www.laroute-angkor.com/component/k2/item/68-tours-by-sub-categories/68-tours-by-sub-categories?cat_id=23&start=5710
即使它在?
之后还有其他内容,所以基本上它可以是?
之后的任何内容,它会重定向,而第一组规则只会在?
之后的内容重定向正好是cat_id=23&start=5710
在同一个订单上。