2014-03-27 84 views
0

我搜索了很多關於htaccess的主題,但仍然沒有成功。htaccess - 重定向查詢字符串並將其刪除

我希望當人們鍵入地址:

http://domain.com/download.php?q=filename1 
http://domain.com/download.php?q=filename2 

它會自動重定向到:

http://domain.com/download/filename1.html 
http://domain.com/download/filename2.html 

我怎樣才能解決這個問題?

回答

0

試試這個:

RewriteEngine On 
RewriteBase/

RewriteCond %{QUERY_STRING} ^q=(.+)$ [NC] 
RewriteRule ^download\.php download/%1.html? [R=301,L] 
相關問題