重定向带有参数且不带页面扩展的页面


redirect a page with parameters and without page extension

我需要重定向这样的页面:

http://example.com/clients/themes?domain=localhost.com

此链接应重定向到皮肤.php它位于同一目录中。

谁能帮我?谢谢。

通过httpd.conf启用mod_rewrite和 .htaccess,然后将此代码放在.htaccess DOCUMENT_ROOT目录下:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ^domain=localhost'.com$ [NC]
RewriteRule ^clients/themes/?$ clients/skin.php? [L,NC]

这会在内部将您的请求转发到/clients/skin.php去除查询字符串。如果您还需要查询字符串,请在skin.php之后删除?