搜索在mod_rewrite的版本自动网址 [英] Search url automatically in mod_rewrite version
问题描述
是否有可能自动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.
这篇关于搜索在mod_rewrite的版本自动网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!