2011-11-08 115 views
2

我正在尋找一種方式來擺脫從我的文件擴展名.php我剛剛得到一個靜態的網站的index.php和map.php的.htaccess創建搜索引擎友好的URL

我有嘗試了很多不同的教程,但沒有工作,我只想要以下內容。

http://example.co.uk/map.php becomes http://example.co.uk/map/ 

http://example.co.uk/index.php becomes http://example.co.uk/ 

爲此,您可以用一個靜態文件我已經嘗試了許多不同的選擇,並沒有爲我工作。

我試過這個。

Options +FollowSymLinks 
RewriteEngine On 
RewriteRule ^map/(.*)/$ map.php 

請任何幫助。

回答

3

試試這個

Options +FollowSymLinks 
RewriteEngine On 

RewriteRule ^map/?$ map.php [NC,QSA,L] 

RewriteCond %{SCRIPT_FILENAME} \/index\.php [NC] 
RewriteRule (.*) http://www.domain.com/ [R=301,L] 

# if you have more than one file like map, you can use this 
# this will redirect everything to .php like: test/ => test.php 
# RewriteRule ^([a-z0-9_\-]+)/?$ $1.php [NC,QSA,L] 
+0

由於生病試試這個,現在這個 – DCHP

+0

沒有工作我不知道爲什麼我需要設置的東西與我的託管??? – DCHP

+0

也許mod_rewrite沒有啓用,你把這@你的網站的根? –

相關問題