[英]How to rewrite the url from www.example.com/index.php?store=test to test.example.com or www.test.example.com in .htacess
I need to rewrite the url from www.example.com/index.php?store=test to
test.example.com or
www.test.example.com
我需要将网址从www.example.com/index.php?store=test重写为
test.example.com或
www.test.example.com
can any body suggest me how to implement the rewrite code in .htaccess file. 任何人都可以建议我如何在.htaccess文件中实现重写代码。
Thanks in advance. 提前致谢。
Try adding the following to /root/.htaccess : 尝试将以下内容添加到/root/.htaccess:
RewriteEngine on
#--Redirect from "www.example.com/index.php?store=test"--#
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$
RewriteCond %{THE_REQUEST} /index\.php\?store=test [NC]
#--to "store.example.com"--#
RewriteRule ^ http://store.example.com [L,R]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.