服务器设置Apache对htaccess支持

Date:2014/04/17       Cat:服务和运维       Word:共800字             

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

1 a2enmod rewrite

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

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

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

 1 <VirtualHost *:80>  
 2 ServerAdmin *@localhost
 3 
 4 DocumentRoot /var/www  
 5   
 6 Options FollowSymLinks  
 7 AllowOverride All  
 8   
 9   
10 Options Indexes FollowSymLinks MultiViews  
11 AllowOverride All  
12 Order allow,deny  
13 allow from all  
14 
15 
16 ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/  
17   
18 AllowOverride None  
19 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch  
20 Order allow,deny  
21 Allow from all  
22 
23 
24 ErrorLog ${APACHE_LOG_DIR}/error.log
25 
26 # Possible values include: debug, info, notice, warn, error, crit,
27 # alert, emerg.
28 LogLevel warn
29 
30 CustomLog ${APACHE_LOG_DIR}/access.log combined  
31   

 

《服务器设置Apache对htaccess支持》留言数:0

发表留言