阿帕奇的.htaccess - 从URL切串并重定向 [英] apache .htaccess - cut a string from url and redirect
本文介绍了阿帕奇的.htaccess - 从URL切串并重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
出于某种原因,谷歌收录几页我的网站为:
For some reason google indexed several pages of my website as:
http://myapp.com/index.php/this-can-be-enything/1234
现在,我想重定向与Apache的.htaccess这些网页,以正确的URL:
Now, I want to redirect with apache .htaccess those pages to correct urls:
http://myapp.com/this-can-be-enything/1234
我GOOGLE和尝试了许多选择,但没有成功。 任何提示将是有益的。
I've googled and tried many options but with no success. Any tip will be helpful.
推荐答案
我已经加入到按照我的.htaccess文件行:
I've added to my .htaccess file following lines:
RewriteCond %{THE_REQUEST} ^.*index.php.*
RewriteRule ^(.*)index.php(.*)$ $1$2 [NC,R=301,L]
我不知道这是不是最好的解决办法,但对我来说工作正常。
I don't know if this is best solution but works ok for me.
这篇关于阿帕奇的.htaccess - 从URL切串并重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文