2013-12-15 97 views
0

在本地主机上我有一个文件filename.html和一个.htaccess在同一个文件夹中。正确配置.htaccess

我需要弄清楚为什么我的.htaccess不工作:

redirect 301 /filename.html http://www.google.com 

我在Linux上,我已经配置服务器:

sudo nano /etc/apache2/sites-available/default 

<VirtualHost *:80> 
     ServerAdmin [email protected] 
     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 
</VirtualHost> 

sudo service apache2 restart 

回答

0

我发现:

RewriteEngine On 
Options +FollowSymLinks 
RewriteRule ^test\.html http://www.google.com/? [R=301,L] 

我的RewriteEngine正在工作。