在我的网站,我是用的URL地址,如
At my website, I was using URL addresses such as
http://me.example.com/index.php?p=home
然后,我决定使用
Then I decided to use
http://me.example.com/?p=home
这一切都自动的工作没有任何的.htaccess文件。但其中含有的index.php的地址也仍然有效。有些网站有链接到我的老格式的网站。我希望人们停止使用旧格式,并将其重定向到新格式的URL,每当他们用老的格式。所有我想要做的是从URL中删除的index.php,改变这个URL在访问者的浏览器。
It all worked automatically without any ".htaccess" file. But addresses which contain "index.php" also still work. Some sites have links to my site in "old" format. I want people to stop using this "old" format and redirect them to the "new" format URL, whenever they use "old" format. All I want to do is to remove "index.php" from URL and also change this URL in visitor's browser.
下面是code,将在.htaccess去下DOCUMENT_ROOT:
Here is the code that will go in .htaccess under DOCUMENT_ROOT:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^index.php/?$ / [L,R=301,NC]