对于一个网站,我目前正在对我们重定向我们的旧的URL的永久换新这样的: 重定向301 /oldfile.php http://www.site.com/show/newurl
For a website I'm currently working on we're redirecting our old URL's permanently to new ones like this: Redirect 301 /oldfile.php http://www.site.com/show/newurl
现在我遇到这种情况,即旧的URL有一个GET变种,如: 重定向301 /oldfile.php?var=name http://www.site.com/show/newurl
Now I come across this situation in which the old url has a get var like: Redirect 301 /oldfile.php?var=name http://www.site.com/show/newurl
这将重定向的oldfile新的URL再加上它增加了获取无功,因此重定向到: http://www.site.com/show/newurl?var=name
This will redirect the oldfile to the new url plus it adds the get var so it redirects to: http://www.site.com/show/newurl?var=name
我将如何设立这个重定向没有获取VAR?
How would I set up this redirect without the get var?
的mod_rewrite
可以去掉查询字符串:
mod_rewrite
can strip off the query string:
RewriteEngine on
RewriteRule ^/?oldfile.php$ http://www.site.com/show/newurl? [R=301,L]
上一篇:更改在Word preSS路径图片路径、图片、Word、preSS
下一篇:该转换使用%(QUERY_STRING)为NGINX重写格式mod-rewrite规则?重写、规则、格式、NGINX