I want to rewrite a dynamic url coming from submit form:
我想重写一个来自提交表单的动态网址:
this is the code of form submit:
这是表单提交的代码:
the correspond url is: mondomain/search.php?id_ac=23
对应的网址是:mondomain / search.php?id_ac = 23
i want to rewrite this to mondomain/23
我想将其重写为mondomain / 23
any help please.
请帮忙。
1 个解决方案
#1
0
You can use:
您可以使用:
RewriteCond %{THE_REQUEST} \s/+search\.php\?id_ac=([^&]+)&id_de=([^\s&]+) [NC]
RewriteRule ^ /%1-%2? [R=302,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^-]+)-([^/]+)/?$ /search.php?id_ac=$1&id_de=$2 [L,QSA,NC]
#1
0
You can use:
您可以使用:
RewriteCond %{THE_REQUEST} \s/+search\.php\?id_ac=([^&]+)&id_de=([^\s&]+) [NC]
RewriteRule ^ /%1-%2? [R=302,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^-]+)-([^/]+)/?$ /search.php?id_ac=$1&id_de=$2 [L,QSA,NC]