.htaccess重写规则和get参数
我需要能够重写.htaccess重写规则和get参数,.htaccess,mod-rewrite,url-rewriting,.htaccess,Mod Rewrite,Url Rewriting,我需要能够重写http://example.com/staging/details/?postid=23使其成为http://example.com/staging/grandhotelterduin 我不确定.htaccess规则应该是什么 我想出了这样的办法 Options +FollowSymLinks RewriteEngine On RewriteRule ^grandhotelterduin/(.*)$ ./details/?postid=23 [L,NC] 我不确定我做的
http://example.com/staging/details/?postid=23
使其成为http://example.com/staging/grandhotelterduin
我不确定.htaccess规则应该是什么
我想出了这样的办法
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^grandhotelterduin/(.*)$ ./details/?postid=23 [L,NC]
我不确定我做的是否正确,你能帮忙吗
我希望它的http://example.com/staging/grandhotelterduin/
重定向到http://example.com/staging/details/?postid=23
但浏览器中显示的url是`请使用以下内容:
RewriteEngine On
RewriteRule ^grandhotelterduin$ /staging/details/?postid=23 [L]
它将为您提供以下URL:
http://sheetz.nl/grandhotelterduin
编辑:
你可以再次检查规则吗?你可以尝试我的编辑,但是当我测试我以前的规则时,它起了作用。确保规则位于
.htaccess
的顶部,并且缓存已清除。
RewriteCond %{THE_REQUEST} /staging/details/?postid=([0-9]+) [NC]
RewriteRule ^ /staging/grandhotelterduin [L,R]