2015-06-05 210 views
1

我有一個簡單的PHP與不同的文件夾/部分和文件與不同的參數工作的小網站。URL重寫規則

http://www.domain.com/folder1/file1.php?id1=66&id2=title_name 

http://www.domain.com/folder1/file2.php?id1=85&id2=11&id3=title_name 

MY TRY

RewriteRule "^/dummy1/(.*)/(.*)/" "/folder1/file1.php?id1=$1&id2=$2" 

RewriteRule "^/dummy2/(.*)/(.*)/(.*)/" "/folder1/file2.php?id1=$1&id2=$2&id3=$3" 

請幫我

+0

是不是工作? – starkeen

+0

我怎樣才能轉發ASP URL到PHP URL http://www.siteurl.com/folder/filename.asp?query1=whatever1&query2=whatever2 到 http://www.siteurl.com/folder/ ?我filename.php QUERY1 = whatever1&QUERY2 = whatever2 –

回答

1

嘗試:

RewriteRule ^/?dummy1/(.*)/(.*)/?$ /folder1/file1.php?id1=$1&id2=$2 [QSA,NC,L] 

RewriteRule ^/?dummy2/(.*)/(.*)/(.*)/?$ /folder1/file2.php?id1=$1&id2=$2&id3=$3 [QSA,NC,L] 
+0

如何轉發ASP URL到PHP URL http://www.siteurl.com/folder/filename.asp?query1=whatever1&query2=whatever2 到 HTTP:/ /www.siteurl.com/folder/filename.php?query1=whatever1&query2=whatever2 –

+0

@Mskhan請在.htaccess標籤上提出關於此問題的新問題。我們會幫助你。 – starkeen