2011-04-07 123 views
1

我如何轉換這個網址乾淨的URL htaccess的

http://localhost/cms/index.php?page=register 

這個

http://localhost/cms/page/register.html 

請幫助...我沒有htaccess的那麼好。

回答

2

試試這個,使其工作就像你希望::)

RewriteEngine on 

RewriteCond %{REQUEST_FILENAME} \/cms\/index\.php 
RewriteCond %{QUERY_STRING} page\=(.*) 
RewriteRule (.*)$ /cms/page/%1.html 

讓我知道,在任何問題的情況下... :)

+0

謝謝夏爾馬:) ..它工作正常 – Jorge 2011-04-11 02:43:09

+0

接受的答案?? :d – 2011-04-11 09:19:37

0

嘗試這個

Options +FollowSymlinks 
RewriteEngine on 
RewriteRule ^cms/([0-9]+)-([a-z]+) http://localhost/cms/index.php?page=$1-$2 [NC] 
+0

抱歉,現在工作... 404 – Jorge 2011-04-07 08:07:34

+0

它工作正常嗎? – 2011-04-07 08:08:11

+0

它是404 T_T在我的機器 – Jorge 2011-04-07 08:10:18