2012-04-06 77 views
0

沒有我的RewriteRules似乎正在工作...httpd.conf rewriterule

我已經嘗試了許多變化,但他們似乎都沒有被讀取。

RewriteEngine On 
RewriteRule (.*) http://www.domain2.com$1 [R=301,L] 

回答

1

包裹在虛擬主機標籤和它的工作。

1

你有一些日誌嗎?如果沒有,啓用RewriteLog並使用高位RewriteLogLevel:http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritelog

此外,不要忘記啓用重寫模塊。

a2enmod rewrite 

而且使用這樣的CONF:

<Directory /var/www/website/html> 
    Options +FollowSymLinks +ExecCGI 

    <IfModule mod_rewrite.c> 
     RewriteEngine On 
     RewriteRule (.*) http://www.domain2.com$1 [R=301,L] 
    </IfModule> 
</Directory> 
+0

我應該指定哪個目錄? – sworded 2012-04-06 16:25:59

+0

你的網站是 – j0k 2012-04-06 17:19:05