2013-10-16 89 views
0

我有一個網站www.website.com和幾個域重定向到這個網站。這是一個蒙面重定向,所以如果我寫www.domain.com我可以一直在瀏覽器中看到這個URL,但它實際上被重定向到subdomain.website.com我想要做的是做一些.htaccess重寫規則,以便所有具有域domain.com的域名將被重新編譯到服務器上的本地文件,該文件位於當前文件夾之外。讓我在這裏解釋的文件夾結構:.htaccess國防部只重寫某些域

/ 
sub/ 
-- subdomain/ 
-- test/ 
---- index.html 
web/ 

目前一切從www.domain.com/sub/subdomain。在裏面 。 htaccess文件/sub/subdomain我想將請求重新路由到/sub/test/index.html。所以在我的.htaccess文件夾sub/subdomain我已經試過這樣:

#start masked redirect 
Options +FollowSymLinks -MultiViews 
# Turn mod_rewrite on 
RewriteEngine On 
#RewriteBase/

RewriteCond %{HTTP_HOST} domain\.com$ [NC] 
RewriteRule .. /test/index.html [L] 
#end masked redirect 


# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 

# END WordPress 

是的,我做這一切WordPress的,我真的不相信的問題,但上面只是要確定我發佈它。

可惜的是,我得到Internal Server Error 500

什麼我做錯了嗎?

另外:請不要問我爲什麼我這樣做,它有一個原因,我沒有發現我想要做的事情,因爲它與這個問題無關,我真的想要在這裏關注這個問題。我只是想知道如何解決我的.htaccess,它必須這樣。感謝您的理解。

+0

安裝在DOCUMENT_ROOT或其他地方WP? – anubhava

+0

WP安裝在/ sub/subdomain文件夾 – Lukas1

+0

基本上我試圖避免在一個特殊情況下使用WP使用.htaccess當使用一個具體的域 – Lukas1

回答

0

這應該是sub/subdomain/.htaccess文件

Options +FollowSymLinks -MultiViews 
RewriteEngine On 

RewriteCond %{HTTP_HOST} ^subdomain\. [NC] 
RewriteRule !^test/index\.html$ /test/index.html [L,NC] 

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 

# END WordPress 
+0

這個不幸的是沒有工作。首先我的RewriteCond是正確的。但這不會是一個問題,我改變了,問題是雖然在RewriteRule中的路徑,我仍然得到500錯誤 – Lukas1

+0

對於哪個網址你得到500錯誤? – anubhava

+0

以及www.domain.com – Lukas1