问题
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/
Now with my new site, I have the URLs set like this:
site.com/blah-blah/
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.
回答1:
RewriteRule ^industry/([a-zA-Z0-9-]+).([0-9]+)/$ /$1/ [R=301]
来源:https://stackoverflow.com/questions/26119817/301-redirect-in-htaccess