.htaccess 301 redirect with regex?
Posted
by
Eddie ZA
on Pro Webmasters
See other posts from Pro Webmasters
or by Eddie ZA
Published on 2012-11-17T15:32:43Z
Indexed on
2012/11/17
17:22 UTC
Read the original article
Hit count: 600
htaccess
|301-redirect
How to do this with regular expression?
Old -> New
http://www.example.com/1.html -> http://www.example.com/dir/1.html
http://www.example.com/2.html -> http://www.example.com/dir/2.html
http://www.example.com/3.asp -> http://www.example.com/dir/3.html
http://www.example.com/4.asp -> http://www.example.com/dir/4.html
http://www.example.com/4_a.html -> http://www.example.com/dir/sub/4-a.html
http://www.example.com/4_b.html -> http://www.example.com/dir/sub/4-b.html
I've tried this:
Redirect 301 /1.html http://www.example.com/dir/1.html
Redirect 301 /2.html http://www.example.com/dir/2.html
Redirect 301 /3.asp http://www.example.com/dir/3.html
Redirect 301 /4.asp http://www.example.com/dir/4.html
Redirect 301 /4_a.html http://www.example.com/dir/sub/4-a.html
Redirect 301 /4_b.html http://www.example.com/dir/sub/4-b.html
© Pro Webmasters or respective owner