2014-12-06 44 views
0

我使用wget將Basecamp安裝映射到Google雲端硬盤。許多被使用以下文件名創建的頁面:將查詢字符串重寫爲文件

文件

files.html?page=4 
files.html?page=5 
files.html?page=6 
files.html?page=7 
files.html?page=8 
files.html?page=9 

指數

log?n=0 

我們能夠修復索引問題與log%3fn=0

DirectoryIndex index.html index.htm log%3fn=0 log report new_more new 

我想看看是否有辦法在.htaccess中添加重寫,這將使

000.000.000.000/projects/11424851-m-domain-com/files.html?page=2

解析爲包含查詢字符串的文件名。

我想重寫必須製造:

000.000.000.000/projects/11424851-m-domain-com/files.html%3fnpage=2

感謝您的幫助! !

回答

1

您可以使用類似:

RewriteEngine On 

RewriteCond %{QUERY_STRING} ^page=(.*)$ 
RewriteRule ^(.*)$ %{REQUEST_URI}\%3Fnpage=%1? [L] 

即匹配以page=開頭的查詢字符串,並將查詢字符串以轉義形式添加到相同的文件名中。

+0

這是一個接受的答案,有一個變化: 'RewriteRule ^(。*)$%{REQUEST_URI} \%3Fpage =%1? [L]' @outlyer - 從%3Fn中刪除了「n」(我的錯誤) 謝謝! – jroakes 2014-12-06 18:01:11