apache rewrite模块无法使用

Python/PHP/Perl 开发与设计
帖子: 6
注册时间: 2010-11-26 15:48
送出感谢: 0
接收感谢: 0

apache rewrite模块无法使用


帖子 weizhao029 » 2011-02-23 19:35

这是apache下 sites-avaliable文件集下default配置
<VirtualHost *:80>
ServerAdmin webmaster@localhost

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

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

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 ::1/128


# 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
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
<IfModule dir_module>
DirectoryIndex index.php index.html index.htm

# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
<FilesMatch "^\.ht">
Order allow,deny
Deny from all

LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so

<Files ~ "^.(htaccess|htpasswd)$">
deny from all
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(douban\.com)(:80)? [NC]
RewriteRule ^(.*) http://www.douban.com/$1 [R=301,L]
order deny,allow
帖子: 805
注册时间: 2008-07-28 19:51
来自: 长沙
送出感谢: 1 次
接收感谢: 2 次

Re: apache rewrite模块无法使用


帖子 be00 » 2011-02-26 13:26

apache rewrite有单独的命令

代码: 全选

zhanggang@T410i:~$ sudo a2enmod rewrite 
[sudo] password for zhanggang: 
Module rewrite already enabled
右边有一只黄手 ----> 或者注册Dropbox中文版感谢我

回到 “Python/Php/Perl”