这是我的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://example.com/example-path/
http://example.com/index.php?bank=example-path/
到
url
但是当我尝试在errors
中传递多个参数时,我得到的只是http://example.com/example-path
。
我需要一个像你这样的网址
http://example.com/index.php?bank=example-path
代替{{1}}
如何更改我的代码以传递多个网址。
答案 0 :(得分:2)
您的重定向逻辑可以大大简化为:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
#If a request does not match an existing directory
RewriteCond %{REQUEST_FILENAME} !-d
#And does not match an existing file
RewriteCond %{REQUEST_FILENAME} !-f
#then rewrite all requests to index.php
RewriteRule ^(.*)/?$ index.php?bank=$1 [L,QSA]