Query string rewriting using .htaccess

泪湿孤枕 提交于 2019-12-02 04:29:50

If you want to capture part of the query string, you must use a RewriteCond with QUERY_STRING

RewriteEngine On
RewriteCond %{QUERY_STRING} p=(.+)
RewriteRule ^/?index.php$ /%1? [R,L]

This redirects the client to the new URL http://www.domain.net/beer.

Have you tried this:?

^([^/\.]+)\/?$

Otherwise I would try the .htacces without the other stuff.

Just:

RewriteEngine On
RewriteBase /
RewriteRule ^([^/\.]+)\/?$ index.php?p=$1
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!