這是我的.htaccess
代碼乾淨的網址重寫。htaccess多個參數重寫乾淨的網址
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase/
RewriteCond %{THE_REQUEST} ^[a-zA-Z]{3,}\s/+index\.php\?bank=([^\s&]+) [NC]
RewriteRule^%1%2%3%4? [R=301,L]
RewriteRule ^([^/]+)/?$ index.php?bank=$1$2$3$4 [L,QSA]
此代碼適用於url
中的單個參數。例如,它rewrites
http://bankifscodes.in/pragathi-krishna-gramin-bank-ifsc-code/
到
http://bankifscodes.in/index.php?bank=pragathi-krishna-gramin-bank-ifsc-code/
但是,當我試圖通過在url
多個參數,我的一切都是errors
。
我需要一個像
http://bankifscodes.in/pragathi-krishna-gramin-bank-ifsc-code/karnataka/bidar
而不是http://bankifscodes.in/index.php?bank=pragathi-krishna-gramin-bank-ifsc-code/karnataka/bidar
一個網址我怎樣才能改變我的代碼通過多個網址。
使用臨時302重定向的發展,而不是永久的301個重定向。 301重定向適用於網站永久移動的情況,例如更改域名。但是,當涉及到URL重寫時,即使在生產環境中,您也會發現不斷移動的東西,而301重定向會因瀏覽器緩存而陷入麻煩。嘗試切換到302重定向,並繼續在不具有重定向緩存的其他瀏覽器中測試,或者從301重定向中清除瀏覽器緩存。 – Ultimater