2010-05-22 71 views
1

幫助,我需要我的網址是這樣的:需要htaccess的

http://example.com/index.php?title=about -> http://example.com/about/ 

標題超過50個,並同去的頁面。

有什麼想法?謝謝

回答

2

雖然mosg的鏈接確實有你正在尋找的答案,但我覺得僅僅解釋你需要的部分可能更容易。

我不確定是否要重定向index.php?title =關於TO/about /,或者如果您想/ about /默默地調用index.php?title = about。

對於/about/ - >/index.php?title=about(默默):

RewriteEngine on # turn on re-writing 
RewriteCond %{REQUEST_URI} !^/index\.php.* # for every non-rewritten request 
RewriteRule ^(.*)$ http://%{HTTP_HOST}/index.php?title=$1 [L] # rewrite to index.php 

對於/index.php?title=about - >/about/(未默默)

RewriteEngine on # turn on re-writing 
RewriteCond %{REQUEST_URI} ^/index\.php?title=.* # for index.php?title=slug request 
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L] # rewrite to /slug/ 

希望這有助於:)