2016-11-16 130 views
0

我想在我的子域http://test.example.com指向所有請求https://www.example.com/test-url-wordpress/,我寫了下面的.htaccess重定向到另一個網址,而不改變URL

RewriteRule ^(.*)$ https://www.example.com/test-url-wordpress/ [NC,L]

這導致rediection給定的頁面,但我不不想更改網址。我也曾嘗試以下解決方案,但它給了我500 Internal Server Error

的RewriteRule ^(。*)$ https://www.example.com/test-url-wordpress/ [P]

注:我想說明從給定的URL內容在 任何要求的情況下,該子域。僅供參考,主要網站上的網站是在wordpress這就是爲什麼我 不能把這個相關的URL如../test-url-wordpress/這裏和事件 沒有工作。

任何幫助將不勝感激。

回答

0

嘗試增加給你的web.config文件 -

<system.webServer> 
<rewrite> 
    <rules> 
    <rule name="Redirect test.example.com to www.example.com" patternSyntax="Wildcard" stopProcessing="true"> 
     <match url="*" /> 
     <conditions> 
     <add input="{HTTP_HOST}" pattern="test.example.com" /> 
     </conditions> 
     <action type="Redirect" url="https://www.example.com/test-url-wordpress/{R:0}" /> 
    </rule> 
    </rules> 
</rewrite> 
</system.webServer> 
+0

嘛!你在哪裏發現這個問題是針對IIS的。 –

+0

服務器是linux上的apache而不是'IIS'。並且記住我的URL不應該在瀏覽器中更改。這將是偉大的知道解決方案。謝謝 – Xkorpion

相關問題