Home  >  Article  >  Backend Development  >  伪静态重写规则

伪静态重写规则

WBOY
WBOYOriginal
2016-06-13 13:33:06890browse

求一个伪静态重写规则
想实现的功能如下:

一个虚拟空间,三个域名想建立三个网站

例如

http://a.com
http://b.com
http://c.com

想实现:
访问:http://a.com 实际是访问虚拟空间根目录中的:index.htm
访问:http://b.com 实际是访问虚拟空间根目录下b文件夹下的:index.htm
访问:http://c.com 实际是访问虚拟空间根目录下c文件夹下的:index.htm


------解决方案--------------------
刚看到你的消息.

对于伪静态什么的写法我也不是很了解.不过你可以这样.
直接include 好了.

PHP code

function curPageURL()
{
    $pageURL = 'http';

    if (isset($_SERVER["HTTPS"])&&($_SERVER["HTTPS"] == "on")) {
        $pageURL .= "s";
    }
    $pageURL .= "://";

    if ($_SERVER["SERVER_PORT"] != "80") {
        $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
    }
    else {
        $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
    }
    return $pageURL;
}

$url=curPageURL();
switch ($url){
    case 'http://a.com':
        include 'index.htm';
        break;
    case 'http://b.com':
        include './b/index.htm';
        break;
    default:
        include 'index.htm';
        break;
} <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