2017-05-29 65 views
-1

我怎樣才能檢索到的URL是這樣的:Apache的前置URL之前請求的URL

http://xxx.example.com/resource/blahblah 

和Apache服務器,並使用國防部重寫改寫這個地址

http://example.com/yyy/zzz/vvv.html?subject=http://xxx.example.com/resource/blahblah 

回答

0

我不知道爲什麼這個問題有一個負面的點!我不知道爲什麼答案是如此無關緊要。無論如何,我自己找到了真正的答案。

創建該路徑下的文件或編輯文件:

sudo nano /var/www/html/.htaccess 

填寫的文件:

RewriteEngine On 

# avoids recursive rewrite of scripts 
RewriteCond %{HTTP_REFERER} ^http://xxx\.example\.com/.*$ 
RewriteRule ^yyy/.* - [L] 

# rewrites scripts and css files 
RewriteCond %{HTTP_REFERER} ^http://xxx\.example\.com/.*$ 
RewriteRule ^(.*)$ yyy/$1 [QSA] 

RewriteRule ^resource/([^\/]*)$ yyy/zzz/vvv.html?subject=http://xxx.example.com/resource/$1 [QSA] 

,並重新啓動Apache服務:

sudo service apache2 restart 
0

保存url的內容。然後上傳apache服務器上的index.html頁面並啓動apache服務器。

+0

我想用國防部 - 重寫,我不能保存所有我的6000000網址在HTML文件! –

+0

mod_rewrite用於重寫URL。例如** www.xyz.com/login/sahil **被轉換爲** www.xyz.com/login.html?name = sahil ** –