htaccess rewriting to remove query parameters

梦想与她 提交于 2019-12-04 06:02:31

问题


i have been trying to find the solution through previous question on SO, but im getting errors when using them. how to make this url : /viewpost.php?postid=81 as /viewpost/81 in the url so that when /viewpost/81 is entered, it shows the content of /viewpost.php?postid=81?


回答1:


You must capture the number and append this number as part of the query string

RewriteRule ^viewpost/(\d+)$ /viewpost.php?postid=$1 [L]


来源:https://stackoverflow.com/questions/16155620/htaccess-rewriting-to-remove-query-parameters

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