Home >Backend Development >PHP Tutorial > 是URL重写还是配置不对解决思路

是URL重写还是配置不对解决思路

WBOY
WBOYOriginal
2016-06-13 13:47:40877browse

是URL重写还是配置不对
服务器上配置了好多子域名,我想把hqdata.net这种重写成www.sycity.com,规则不知道怎么写,网上搜了半天也没搞明白,高人指点一下。
另外说一下,在地址栏中输入hqdata.net实际上出来的内容是www.sycity.com的,但是地址栏里面里面还是hqdata.net,看起来很别扭,这个应该是url重写的问题吧

------解决方案--------------------

PHP code

    header("location: ".url_getHost('site'));

function url_getHost($host='www'){
    $domain=($host?$host.'.':'').'baidu.com';
    $url='http://'.$domain.'/';
    return $url;
} <div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn