2013-12-15 156 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正在工作。