WampServer设置apache伪静态出现404 not found及You don't have permission to access / on this server解决方法 W
人气:2想了解WampServer设置apache伪静态出现404 not found及You don't have permission to access / on this server解决办法分析 原创的相关内容吗,在本文为您仔细讲解WampServer设置apache伪静态出现404 not found及You don't have permission to access / on this server解决办法的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:WampServer,apache,伪静态,404,not,found,You,don''t,have,permission,to,access,on,this,server,解决办法,下面大家一起来学习吧。
本文实例讲述了WampServer设置apache伪静态出现404 not found及You don't have permission to access / on this server解决方法。分享给大家供大家参考。具体如下:
出现404 not found 时:
确保LoadModule rewrite_module modules/mod_rewrite.so开启
然后
复制代码 代码如下:
<Directory />
Options FollowSymLinks
AllowOverride none #此处把none 改成All
Order allow,deny
deny from all
</Directory>
Options FollowSymLinks
AllowOverride none #此处把none 改成All
Order allow,deny
deny from all
</Directory>
出现:You don't have permission to access / on this server
复制代码 代码如下:
<Directory />
Options FollowSymLinks
AllowOverride none #此处把none 改成All
Order allow,deny
deny from all #此处把deny改成Allow
</Directory>
Options FollowSymLinks
AllowOverride none #此处把none 改成All
Order allow,deny
deny from all #此处把deny改成Allow
</Directory>
确保设置了默认首页:
复制代码 代码如下:
<IfModule dir_module>
DirectoryIndex index.html index.htm index.php
</IfModule>
DirectoryIndex index.html index.htm index.php
</IfModule>
有时候在WampServer上设置Apache伪静态还是会出现
You don't have permission to access / on this server
的提示
这时候进一步修改:
复制代码 代码如下:
<Directory />
Options FollowSymLinks #此处将FollowSymLinks改为All
AllowOverride All
Order allow,deny
deny from Allow
</Directory>
Options FollowSymLinks #此处将FollowSymLinks改为All
AllowOverride All
Order allow,deny
deny from Allow
</Directory>
将Options FollowSymLinks改为:Options All
问题即可解决。
附(伪静态测试代码):
新建php页面index.php:
<?php if($_GET){ echo $_GET["id"]; } ?>
同级目录下建立文件.htaccess,写入伪静态规则如下:
复制代码 代码如下:
RewriteEngine On
RewriteRule ^t_(.*).html$ index.php?id=$1
RewriteRule ^t_(.*).html$ index.php?id=$1
URL地址栏写入:
http://localhost/t_aaa.html
伪静态设置成功则输出:aaa
希望本文所述对大家的Apache服务器设置有所帮助。
加载全部内容