9
我想在我的.htaccess文件中創建的結構如下:有沒有辦法在Apache htaccess中重寫if/else?
If (SITE A DOMAIN or SITE A SUBDOMAIN) {
Rewrite this specific way -> /index.php/$1
} else {
Rewrite this specific way -> /directory/www/index.php/$1
}
下面我有我當前的代碼,但它拋出500S與我的Apache錯誤日誌抱怨:
[錯誤] [客戶端:: 1] mod_rewrite:達到的內部重定向的最大數量。假設配置錯誤。如果需要,使用'RewriteOptions MaxRedirects'來增加限制。引用:
我在做什麼錯?謝謝!
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|blog)
RewriteCond %{HTTP_HOST} ^subdomain\.example\.com$ [NC,OR]
RewriteCond %{HTTP_HOST}^example\.com$
RewriteRule .? - [S=1]
RewriteRule ^(.*)$ /directory/www/index.php/$1 [L]
RewriteRule .? - [S=1]
RewriteRule ^(.*)$ /index.php/$1 [L]
謝謝,工作! – 2012-08-10 20:32:29