[英]Two different Query string redirect to same structure Htaccess
請幫幫我,我有兩種情況,我有一個 URL 來重定向,例如
https://example.com/about-us我的重寫規則是
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$ index.php?pageName=$1 [QSA,L]
它適用於所有帶有查詢 pageName 的頁面。
我想將不同的查詢字符串重定向到相同的結構,就像我有 URL 一樣
https://example.com/index.php?filter=latest
我想將它重定向到上面關於我們頁面的相同格式,例如
https://example.com/latest
怎么可能? 請幫助我,謝謝
您不能對兩個規則使用相同的格式或 URI 模式,但是您可以將第二個 URL 格式更改為類似於https://example.com/second/latest
的second
可以是您想要添加到規則模式中的任何單詞
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^second/([^/]+)/?$ index.php?filter=$1 [QSA,L]
請記住將此規則放在頂部或現有規則之前。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.