2014-11-03 53 views
0

在找到由通URL基於標頭值, 當請求來Apache服務器將檢查頭,並且如果值= TEST1基於報頭的Apache旁路URL

它將重寫代理通URL exampel :

www.demo.test.com >> to 

www.end.test.com

如果值爲null,則它將在URL中使用傳遞給

www.null.test.com 

什麼是測試這種情況下

回答

0

您可以檢查HTTP頭有RewriteCond,例如最好的辦法

RewriteCond %{HTTP:Some-Header} test1 
RewriteRule^http://www.demo.test.com [L] 

基於該意見,當請求index.html和報頭Video: Provider1被髮送,重寫到demo.test.com/provide1/m3u8.mp4。如果標題是Video: Provider2,改寫爲demo.test.com/provide/m3u8.mp4

RewriteCond %{HTTP:Video} ^Provider1$ 
RewriteRule ^index.html$ http://demo.test.com/provide1/m3u8.mp4 [L] 

RewriteCond %{HTTP:Video} ^Provider2$ 
RewriteRule ^index.html$ http://demo.test.com/provide/m3u8.mp4 [L] 
+0

我不想重定向URL本身,我想重定向特定的「子網址」這將是代碼 – LeoSam 2014-11-03 08:12:18

+0

內在要求,我不理解這一點。如果你不想基於HTTP頭重寫,你的要求到底是什麼? – 2014-11-03 08:15:06

+0

生病解釋它更好的辦法: – LeoSam 2014-11-03 08:19:14