简体   繁体   English

如何将网址从www.example.com/index.php?store=test重写为.htacess中的test.example.com或www.test.example.com

[英]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.comwww.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.

相关问题 Ubuntu-如何直接将example.com/opencart/index.php定向到http://example.com/和www.example.com? - Ubuntu - How direct example.com/opencart/index.php to http://example.com/ and www.example.com? 为什么www.example.com/index.php/my/path/here由index.php处理? - Why www.example.com/index.php/my/path/here is processed by index.php? 在htacess中从https://example.com重定向到https://www.example.com - Redirecting from https://example.com to https://www.example.com in htacess URL重写从www.example.com/blog/blog.php到www.example.com/blog/ - URL rewriting going from www.example.com/blog/blog.php to just www.example.com/blog/ Nginx规则,用于将http://www.example.com/test重定向到test.domain.com - Nginx rule for redirecting http://www.example.com/test to test.domain.com 当我在地址栏中按回车键时,Laravel 6 重定向到 https://www.example.com/index.php,地址为 www.example.com/profile? - Laravel 6 redirecting to https://www.example.com/index.php when I press enter in the address bar with an address of www.example.com/profile? WordPress mod_rewrite规则。 停止从example.com重定向到www.example.com - Wordpress mod_rewrite rule. Stop redirecting from example.com to www.example.com 通过www.example.com/page而不是www.example.com/page.php访问URL - Accessing URLS by www.example.com/page instead of www.example.com/page.php 如何使用.htaccess将http://example.com/test.php设置为http://example.com/index.php?do=test? - How to make http://example.com/test.php to http://example.com/index.php?do=test using .htaccess? example.com和www.example.com被视为不同的会话 - example.com and www.example.com are treated as different sessions
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM