这是我的.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