Welcome to WebmasterWorld Guest from 184.108.40.206 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Become a Pro Member
Help With Using Redirectmatch Redirectmatch wiseapple
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.
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
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
Thanks for the help! I will give the above a try. I am hopeful this will solve my problem.