0

Hell guys, can someone help me with a .htaccess rule to redirect such url type:

old url: video/displayresults/?pattern=searchedword

new url: video/search/?searchword=searchedword

So i want to redirect any old url to the new url

Thanks

4

2 回答 2

0

启用mod_rewrite.htaccess通过httpd.conf(如果尚未启用),然后将此代码放入您的DOCUMENT_ROOT/.htaccess文件中:

RewriteEngine On

RewriteCond %{QUERY_STRING} ^pattern=(.*)$ [NC]
RewriteRule ^(video)/displayresults/?$ /$1/search/?searchword=%1 [L,NC,R=301]
于 2013-11-04T05:57:57.053 回答
0

您想查找 htaccessRewriteRule指令。您需要构建它捕获的正则表达式“/displayresults/?” 并将其解析为“/search/”。确保您启用了 mod_rewrite

例子:

RewriteRule ^(. )/displayresults/(.)$ 1/search/$2

这假定 displayresults 是一个文件夹名称。

于 2013-11-03T22:12:35.160 回答