服务器设置Apache对htacce

时间:2014-12-04 21:15:37   收藏:0   阅读:218

root权限下运行a2enmod(a2enmod是一个可以配置Apache的工具,a2enmod是属于apache2.2-common包下的一个工具),然后输入rewrite启动apache对于.htaccess的支持。

a2enmod rewrite

在debian下默认的httpd.conf文件是空的,如果需要对相应目录设置AllowOverride,可以直接进入:

/etc/apache2/sites-enabled/000-default

可以按照要求把需要支持的地方的AllowOverride None改为AllowOverride All,如下例中:

<VirtualHost *:80>
ServerAdmin *@localhost

DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!