由网友(我把太阳磨圆)分享简介:是否有可能自动mod_rewrite的点击搜索按钮后,设置形式的行动属性?Is it possible to set a forms action property automatically with mod_rewrite after clicking on a search button?正常的URL是这样的...
是否有可能自动mod_rewrite的点击搜索按钮后,设置形式的行动属性?
Is it possible to set a forms action property automatically with mod_rewrite after clicking on a search button?
正常的URL是这样的: http://www.website.com/search.php?search=name
normal url is this: http://www.website.com/search.php?search=name
mod_rewrite的URL是这样的: http://www.website.com/search/name.html
mod_rewrite url is this: http://www.website.com/search/name.html
我知道这是可以设置与htaccess的页面的mod_rewrite的版本,但如何将我的形式直接进入mod_rewrite的网址是什么?
I know that it is possible to set a mod_rewrite version of the page with htaccess, but how would I have the form go directly to the mod_rewrite url?
问候
推荐答案
这应该工作:
RewriteEngine On
RewriteCond %{THE_REQUEST} ^(GET|POST) /search.php?search=(.*) HTTP
RewriteRule ^ /search/%2.html? [R=301,L]
RewriteRule ^search/(.*).html$ /search.php?name=$1 [L]
它应该会自动打开正常连接到mod_rewrite的链接。
It should automatically turn the normal link into the mod_rewrite link.
相关推荐
最新文章