我的問題很簡單。我有我的主網頁(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