我有兩個域當前在我的服務器中,一個用於主域(www.domain.com
),另一個用於測試域(test.domain.com
)。每個域指向一個包含Joomla安裝的文件夾,並且在每個文件夾中都有安裝隨附的標準.htaccess
文件。將重定向子域中的index.php重寫爲.htaccess中的重定向子域
主域名正常工作,但測試域並不像預期的那樣正常工作。如果我瀏覽到test.domain.com
,我可以正確地看到主頁,但是如果我瀏覽其他任何地方(即test.domain.com/products.html
),則會出現500錯誤。但是,如果我在子域後附加index.php
,它按預期工作(即test.domain.com/index.php/products.html
)。
這是.htaccess
文件/public_html
文件夾:
Options +FollowSymLinks
RewriteEngine On
RewriteBase/
# pointing www.domain.com to live
RewriteCond %{HTTP_HOST} !test.domain.com
ReWriteCond %{HTTP_HOST} www.domain.com
ReWriteCond %{REQUEST_URI} !^/live/
ReWriteRule ^(.*)$ live/$1 [L]
# pointing test.domain.com to test
ReWriteCond %{HTTP_HOST} test.domain.com
ReWriteCond %{REQUEST_URI} !^/test/
ReWriteRule ^(.*)$ test/$1 [L]
# Add a trailing slash to directories
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.)
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ([^/]+)$ $1/ [L]
# Rewrite any calls to /* to the index.php file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ index.php/$1 [L]
下面是在服務器中的文件夾結構:
/public_html
|
|--/live <-- www.domain.com
| |
| |--.htaccess <-- joomla standard .htaccess
|
|--/test <-- test.domain.com
| |
| |--.htaccess <-- joomla standard .htaccess
|
|--.htaccess
的.htaccess
文件在live
和test
文件夾分別有RewriteBase /live
和RewriteBase /test
。
我發現了幾個關於子域重定向的問題,這裏在stackoverflow和許多其他網站,但他們都沒有解決這個具體問題。有誰知道我錯過了什麼?
謝謝。
我把子域規則的主要領域之前,但它不起作用。我仍然有同樣的問題。 –