这是apache下 sites-avaliable文件集下default配置
<VirtualHost *:80>
ServerAdmin webmaster@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 All
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
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
httpd.conf配置
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks ExecCGI Indexes
AllowOverride All
Order deny,allow
Deny from all
Satisfy all
</Directory>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.php index.html index.htm
</IfModule>
#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
Order allow,deny
Deny from all
</FilesMatch>
mods-enabled文件夹下
rewrite.load文件
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
.htaccess文件测试如下
<Files ~ "^.(htaccess|htpasswd)$">
deny from all
</Files>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(douban\.com)(:80)? [NC]
RewriteRule ^(.*) http://www.douban.com/$1 [R=301,L]
order deny,allow
apache rewrite模块无法使用
-
- 帖子: 6
- 注册时间: 2010-11-26 15:48
- be00
- 帖子: 805
- 注册时间: 2008-07-28 19:51
- 来自: 长沙
- 联系:
Re: apache rewrite模块无法使用
apache rewrite有单独的命令
代码: 全选
zhanggang@T410i:~$ sudo a2enmod rewrite
[sudo] password for zhanggang:
Module rewrite already enabled