[英]php and htaccess, url rewriting by mysql table id and other column
[英]URL rewriting with other actions
我目前有一個PHP Web應用程序,該URL接受URL為:/page.3,索引文件獲取該數字並使用它:
/page.3 > $_GET['id'] = 3
IIS URL重寫模式為:
^([^/]+/)*([^/]+/)\.(\d+)$
並產生index.php?id={R:3}
但是,我希望能夠指定其他參數,例如
/page.3&do=4 > $_GET['id'] = 3 and $_GET['do'] = 4
有什么辦法可以使用IIS Rewriting或PHP做到這一點?
由於某種原因,我無法讓您的正則表達式匹配url中的/page.3
類的/page.3
,所以我想出了自己的正則表達式:
<rewrite>
<rules>
<rule name="RWW" enabled="true" stopProcessing="true">
<match url="((.+)\.(\d+))" />
<action type="Rewrite" url="index.php?id={R:3}" />
</rule>
</rules>
</rewrite>
默認情況下,重寫器將追加您的查詢字符串。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.