301重定向htaccess的 [英] 301 redirect in htaccess
本文介绍了301重定向htaccess的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我改变了,所以我需要能够重定向他们我所有的文章的URL,但是这是我是如何它的htaccess之前设置:
I changed the URL of my articles so I need to be able to redirect them all, but this is how I had it set before in htaccess:
RewriteRule ^industry/([a-zA-Z0-9-]+).([0-9]+)/$ index.php?tag=industry&slug=$1&id=$2
这将使我是这样的:
Which would give me something like:
site.com/industry/blah-blah.6842/
现在我的新的网站,我有这样设置的URL:
Now with my new site, I have the URLs set like this:
site.com/blah-blah/
所以,我怎么可以做301重定向htaccess的?我不能做所有的文章单独因为有他们吨。
So how I can do a 301 redirect in htaccess? I can't do all the articles individually because there's tons of them.
我需要能够重定向这样的:
I need to be able to redirect this:
^industry/([a-zA-Z0-9-]+).([0-9]+)/$ to this: ^/([a-zA-Z0-9-]+)/$
在此先感谢。
Thanks in advance.
推荐答案
重写规则^业/([A-ZA-Z0-9 - ] +)([0-9] +)/ $ / 1 $ / [R = 301]
RewriteRule ^industry/([a-zA-Z0-9-]+).([0-9]+)/$ /$1/ [R=301]
这篇关于301重定向htaccess的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文