doubeng3216 2015-01-14 21:48
浏览 43
已采纳

PHP - 带.htaccess的子域名

I currently have page example/test/ leading to page example/site/index?sid=1 using the .htaccess rule below:

RewriteEngine on
RewriteRule ^test/(.*) site/$1?sid=1

I am wanting to have test.example.com lead to example/site/index?sid=1 as before however after using Google for a while I can only find .htaccess rules that REDIRECT the sub-domain to the page. I want to have it on the sub-domain but displaying the page.

I just want to add, I have found some questions on here already with answers that should work but I just get a "web page not available" error. Does the subdomain need to be created first for DNS etc?

Hopefully that makes sense! Any help is appreciated!

  • 写回答

1条回答 默认 最新

  • doushu2699 2015-01-14 21:55
    关注

    i prefere to read the FQDN via PHP.

    if ( isset($_SERVER['HTTP_HOST']) && $_SERVER['HTTP_HOST'] == 'test.example.com' ) {
        $_GET[ 'sid' ] = 1;
        // or what ever
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况
  • ¥15 画两个图 python或R