2010-03-18 55 views
5

我用wget -m -k -E颳了一堆頁面。結果文件的名稱形式爲foo.php?bar.html。阿帕奇猜測後的一切?是一個查詢字符串,有沒有辦法告訴它忽略?作爲查詢字符串分隔符(並將foo.php?bar.html作爲請求的文件而不是foo.php)?有沒有辦法讓Apache以其名稱中的問號提供文件?

爲了節省您去一趟wget的手冊頁:
-m:鏡遞歸
-E:foo.php欄將變爲foo.php一個bar.html
-k:在轉換頁面上的鏈接(foo中。 php?bar現在鏈接到foo.php?bar.html內部的所有頁面,以便它們正確顯示)

+0

爲了什麼目的?文件系統上確實有一個名爲foo.php?bar.html的文件?或者是日誌的問題?還有別的嗎? – symcbean 2010-03-18 10:03:03

+0

是的,在foo.php?bar.html名稱的文件系統上有一系列文件。他們是wget的-E標誌的結果。 – ldrg 2010-04-08 16:35:11

回答

4

會逃脫?作爲%3F做的伎倆?

3

Apache v1用於處理它們,但是v2不支持。

我用mod_rewrite做了。納森斯在代碼中的建議:

RewriteEngine On 

# Convert ? -> %3F in queries and add .html to the end of the filename 
RewriteCond %{ENV:REDIRECT_STATUS} !200 
RewriteCond %{QUERY_STRING} !^$ 
RewriteRule ^(.*)$ /$1\%3F%{QUERY_STRING}.html [L,NE] 

# An addition for *.php files without question mark in its name, adding html to the end of the filename 
RewriteRule ^(.*?)\.php$ $1.php.html 
相關問題