环境是apache服务器,对typecho伪静态配置时,在.htaccess写了伪静态的代码,打开网站后却发现这么一个错误提示:

You don’t have permission to access / on this server.

找到apahce日志 /var/log/httpd/error_log

Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden:

解决:

在.htaccess文件的开始添加  

Options +FollowSymLinks

添加后的文件

#伪静态
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
# 下面是在根目录,文件夹要修改路径,如 /typecho/,同时 RewriteRule 也要跟着变
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>