Php 如何将此URL重定向到HTACCESS文件中的我的主页

Php 如何将此URL重定向到HTACCESS文件中的我的主页,php,.htaccess,url,redirect,Php,.htaccess,Url,Redirect,我是PHP新手, 我想通过编辑HTACCESS文件将此URL重定向到我的主页www.laroute-angkor.com 这里是访问者单击或访问时我要重定向的url: 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

我是PHP新手, 我想通过编辑HTACCESS文件将此URL重定向到我的主页www.laroute-angkor.com

这里是访问者单击或访问时我要重定向的url:

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 www.laroute-angkor.com/component/k2/item/68分类别旅游/68分类别旅游?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
下面将把上面提到的所有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

@plantheidea和@Prix i不知道这些讨论,我知道我的回答有点粗鲁。与其说是浪费资源和时间来回答这样一个简单而明显的问题,以至于有人能在几秒钟内找到答案,还不如说是粗鲁,但无论如何都是粗鲁的。以后我将投票结束,并在你要求帮助之前就如何需要最简单的调查形式发表评论。谢谢帮助谢谢帮助谢谢帮助谢谢帮助我不能投票赞成,它需要声誉15,但可以单击“接受”按钮吗answer@MsyMarina谢谢,你不需要投票,只要接受它作为正确的答案就足够了。