我的问题很简单。我有我的主网页(www.domain.com/index.php)网站重定向
有没有办法将用户重定向到的index.php时,他只种www.domain.com?
同时从网址中删除index.php?
我检查了一下.htaccess,但没有一个技巧似乎能完成这项工作。
谢谢!
编辑
这里是我的.htaccess:
# To set your custom php.ini, add the following line to this file:
# suphp_configpath /home/yourusername/path/to/php.ini
DirectoryIndex index.php
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
<Files .htaccess>
order allow,deny
deny from all
</Files>
Options All -Indexes
正如你所看到的,我把DirectoryIndex的index.php文件在里面,但不会改变它:(
1&2种冲突,不要t嘿? “去那里,但不要表明你在那里”。除了在Apache中使用index.php作为默认文档(使用DirectoryIndex作为下面的Hamish回答),您无法真正控制用户在地址栏中看到的内容。 – 2011-02-22 22:16:19
@Marc,当然你可以 - 这就是HTTP重定向的目的。 'index.php'→'/'external,'/'→'index.php'内部,非常有意义:) – aaz 2011-02-22 22:25:33
hehe我的意思是:用户类型www.domain.com,他被重定向到www.domain.com/ index.php,但它保持www.domain.com。基本上,index.php成为默认页面。 – Elggetto 2011-02-22 22:27:25