htaccess RewriteRule只是查询字符串的一部分

时间:2014-06-11 14:16:44

标签: regex apache .htaccess mod-rewrite

我需要一个像:

这样的请求
www.mydomain.com/books/catalog.html?param1=abc&param2=123param3=etc

内部重写,以便从:

提供内容
www.mydomain.com/index.php?page=books/catalog.html&param1=abc&param2=123&param3=etc

1 个答案:

答案 0 :(得分:1)

将此代码放入DOCUMENT_ROOT/.htaccess文件中:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ /index.php?page=$1 [L,QSA]