PHP   发布时间:2022-04-04  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了php-子网域的网址重写大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

情况很简单.我在cpanel中创建了一个通配符子域,其内容类似于:* .mysite.com.

我可以加载页面,但是我想将通配符的值用作GET的参数,以便页面可以实际基于该GET值显示相关内容.

因此,我想知道的是是否有可能拥有允许我执行以下操作的重写规则.

从网址:http://andystore.mysite.com获取:$_ GET [‘store’] ==’Andystore’

解决方法:

您可以在DOCUMENT_ROOT / .htaccess文件中使用以下代码

RewriteENGIne On
RewriteBase /

# capture first part of host name
RewriteCond %{http_HOST} ^([^.]+)\.mysite\.com$[NC]
# make sure store= query parameter isn't there
RewriteCond %{QUERY_StriNG} !(^|&)store= [NC]
# rewrite to current URI?store=BACkererence #1 from host name
RewriteRule ^ %{requEST_URI}?store=%1 [L,QSA]

Apache mod_rewrite Introduction

Apache mod_rewrite Technical Details

大佬总结

以上是大佬教程为你收集整理的php-子网域的网址重写全部内容,希望文章能够帮你解决php-子网域的网址重写所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: