2013-04-03 53 views
0

我不太熟悉配置我的.htaccess,所以請幫助我。將index.php請求重定向到http:// localhost/website /使用.htaccess

我有去到的index.php一個鏈接,但我不想index.php文件出現在我的網址

eg. 
http://localhost/website/index.php 

我希望它被重定向到根文件夾是

http://localhost/website/ 

所以我試圖尋找答案,這是我到目前爲止。

RewriteEngine on 

Options +FollowSymLinks 
RewriteCond %{THE_REQUEST} ^.*/index.php 
RewriteRule ^(.*)index.php$ http://localhost/website/$1 [R=301,L] 

現在,當我嘗試點擊我的本地網站的主頁,而不是重定向我

http://localhost/website 

它被重定向到這一點 -

http://localhost/Applications/XAMPP/xamppfiles/htdocs/website/localhost/website/ 

誰能解釋這是怎麼回事上?

+0

框架巴託空也明白了嗎? –

+0

沒有。不是一個框架。 –

回答

0

做你試試這個

RewriteRule ^(.*)$ /index.php/$1 [L] 
0

我和我的.htaccess不只要我刷新頁面生效所做的更改。花了一些時間清理我的緩存以查看效果。我嘗試了不同的方法,我的問題:

Options +FollowSymLinks 
RewriteEngine on 

#RewriteCond %{THE_REQUEST} ^.*/index.php 
#RewriteRule ^(.*)index.php$ http://localhost/website/$1 [R=301,L] 

#RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /?(.*)/index\.php 
#RewriteRule^/%1 [L,R=301] 

#RewriteRule ^(.*)$ /index.php/$1 [L] 

與#的線條沒有可能解決我的問題,因爲它的緩存沒有被清除,但反正 下面這行解決了我的問題,但我花了5次,以清除我的緩存之前,我真的看到了結果。

RewriteRule ^index.php(.*)$ http://localhost/website/$1 [R=301,NC] 

我從htaccess generator

相關問題