2014-03-27 83 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] 
相关问题