2011-10-03 31 views
0

好的,我有一個問題。比方說,我希望能夠訪問這個URL關於htaccess,PHP和隱藏變量傳遞

`forum.mysite.com/offtopic/23894/` 

,併爲它傳遞變量

`forum.mysite.com/file.php?board=offtopic&thread=23894` 

沒有人看見的字符串。有沒有什麼辦法可以用.htaccess或其他方法做到這一點?

+3

這是http://stackoverflow.com/questions/7619933/rewriting-url-to-hide-index-php-and-to-make-query-nice/7620000的副本。請在下次查找現有帖子時,在stackoverflow上有類似這些問題的TONS ... –

回答

6
RewriteEngine on 
RewriteRule /([^/]+)/([0-9]+)/ file.php?board=$1&thread=$2 

,如果你把它放在一個.htaccess文件應工作。