SchmitzIT SchmitzIT -4 years ago 126
Apache Configuration Question

301 redirect, conflicting with RewriteRule

We did some maintenance today, and moved our web forums from /forums into the root folder of the domain.

We put in a redirect 301 in a .htaccess file:

Redirect 301 /forums/ http://www.ourforums.com/


However, we used to have some links that contained duplicate /forums folders. I.e. www.ourforums.com/forums/forums/forum.1

Obviously the redirect from above now leads to /forum.1, which odes not exist. I would like the old link to actually point to www.ourforums.com/boards/forum.1. I attempted to use something like:

RewriteRule ^/forums/forums http://www.ourforums.com/boards/ [NC,R=301,L]


Regardless of what I tried though, the Redirect seems to supersede any RewriteRules I put in the same file, regardless of whether I place them before the Redirect.

Is there any way I can somehow ensure the RewriteRule is handled before the Redirect?

Answer Source

Manually adding redirect statements like so seems to do the trick for me:

Redirect /forums/forums/forum.1 http://www.ourforums.com/boards/forum.1
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download