Htaccess directory with parameter to url parameters

﹥>﹥吖頭↗ 提交于 2021-01-28 05:53:49

问题


I have a url domain/p1/p2/p3/?order=p4

I would like to convert this into all parameter using htaccess like: domain?var1=p1&var2=p2&var3=p3&order=p4

This is what I'm using right now:

RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)/\order=[A-Za-z]?$ page.php?var1=$1&var2=$2&var3=$3&order=$4 [NC,L]

回答1:


You don't need to match query parameter ?order=p4 here and you will need QSA flag:

RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)/?$ page.php?var1=$1&var2=$2&var3=$3 [QSA,L]


来源:https://stackoverflow.com/questions/28970908/htaccess-directory-with-parameter-to-url-parameters

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!