Welcome to WebmasterWorld Guest from 18.104.22.168 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Become a Pro Member
Help With Using Redirectmatch Redirectmatch wiseapple msg:3371009 1:02 pm on Jun 18, 2007 (gmt 0) Greetings, Looking for a bit of help on if redirectmatch will solve my problem.
I am trying to do a permanent redirect from the following:
http://example.com/old-sub-cat/article-10.shtml --- redirect to --->
Can I use reditectmatch to accomplish this? I am try to avoid adding individual lines to .htaccess because I have thousands to do.
Here is what I was thinking:
RedirectMatch /old-sub-cat/article-*.shtml http://example.com/cat/new-sub-cat/article-$.sthml
Am I close?
Appreciate all help.
milanmk msg:3371108 2:51 pm on Jun 18, 2007 (gmt 0)
If you are moving the whole directory then a simple redirect will do the work. RedirectPermanent /old-sub-cat/ http://example.com/cat/new-sub-cat/
Well you were quite close in your RedirectMatch
jdMorgan msg:3371110 2:53 pm on Jun 18, 2007 (gmt 0)
Your regular-expressions pattern is not quite right, the redirect type is not specified, and the back-reference syntax is incorrect. Try: RedirectMatch 301 ^/old-sub-cat/article-([^.]+)\.shtml$ http://example.com/cat/new-sub-cat/article-$1.shtml I'm also assuming that the "sthml" in the substitution URL was a typo.
For more information, see the
Apache mod_alias documentation [ httpd.apache.org] and the documents cited in our forum charter [ webmasterworld.com], particularly the regular-expressions tutorial cited there.
edited by: jdMorgan at 2:54 pm (utc) on June 18, 2007] wiseapple msg:3371643 12:44 am on Jun 19, 2007 (gmt 0)
Thanks for the help! I will give the above a try. I am hopeful this will solve my problem.