我需要重定向这样的页面:
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
之后删除?
。