Apache添加虚拟主机及伪静态

利用Apache添加虚拟主机
1、示例代码:
#<VirtualHost *:80>
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
2、亲测代码:
<VirtualHost *:80>
    DocumentRoot /home/www/xxx
    ServerName xxx.com
    ServerAlias *.xxx.com
    DirectoryIndex default.php default.htm index.php index.htm
    //此处可添加伪静态代码
    RewriteEngine on    //开启重写状态
    RewriteRule ^/news_list_([a-z]+)_([0-9]+).html$ /news_list.php?id=$2&action=$1 //需伪静态的页面
    //此处可添加伪静态代码
    <Directory "/home/www/xxx">
        Options None
        AllowOverride None
        order Deny,Allow
        Allow from all
    </Directory>
</VirtualHost>


文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags:
相关日志:
评论: 0 | 引用: 0 | 查看次数: 2616
发表评论
你没有权限发表评论!