Home  >  Article  >  Backend Development  >  搜了N变教程,还是没配置好apache 虚拟目录 伪静态,求大家帮忙看下问题出在哪

搜了N变教程,还是没配置好apache 虚拟目录 伪静态,求大家帮忙看下问题出在哪

WBOY
WBOYOriginal
2016-06-23 14:27:02786browse

根据网上搜索的教程来配置apache 虚拟目录伪静态,结果还是无法实现,请大家帮忙找下原因,非常感谢!

第一步:开启伪静态

将httpd.conf中#LoadModule rewrite_module modules/mod_rewrite.so,取消注释

将AllowOverride None全部替换成AllowOverride All



第二步:开启虚拟目录

将httpd.conf中#Include conf/extra/httpd-vhosts.conf,取消注释

并在httpd-vhosts.conf中配置虚拟目录,虚拟目录内容如下


<VirtualHost 127.0.0.2>    ServerAdmin admin@system    DocumentRoot "F:/phpsite/myweb"    ServerName 127.0.0.2	<Directory "F:/phpsite/myweb">        Options Indexes FollowSymLinks        AllowOverride All        Order allow,deny        Allow from all    </Directory></VirtualHost>



第三步:配置.htaccess重写规则

.htaccess文件内容如下


<IfModule mod_rewrite.c>        RewriteEngine on        RewriteRule ^/conf_([0-9]*).html /conf.php?arg=$1</IfModule>




第四部:设置conf.php文件内容和重启apache




查了一晚上的资料还是没搞定,好捉急!!!


回复讨论(解决方案)

配置虚拟机

    DocumentRoot "F:/phpsite/myweb"
    ServerName 127.0.0.1:8009
    ErrorLog "logs/web.log"


apache支持伪静态

    Options Indexes FollowSymLinks MultiViews ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all

RewriteRule conf_([0-9]*).html curl.php?arg=$1

这样试了下可以

非常感谢两位!纳闷了。我昨天写的正则居然不行。今天又正常了,太妖孽了!

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
Previous article:apache配置问题Next article:FastCGI Error