Redirect with an exception

Posted on

Redirect with an exception – Problems with loading a website are often blamed on the Internet connection, but even the most perfectly set up network cannot help if there is no service to reply at your destination. One of the most popular HTTP servers used for this task is Apache2. Much of Apache’s popularity can be attributed to its easy installation and use, but never the less it is possible to run into problems with even the easiest of the software. If you’ve encountered an issue loading your web page, follow these simple troubleshooting methods outlined in this guide to attempt to get your web server back up and working again. Below are some tips in manage your apache2 server when you find problem about apache-2.2, mod-rewrite, redirect, , .

I think this is easy but I am afraid I cannot solve this all by myself.

I have moved a website to another domain, and I’ve set up some permanent redirections. However, I’d like to preserve one URL from any rewrite. Right now my configuration is like this:

Redirect permanent /olduser/exception/ ???
Redirect permanent /olduser/dir/
Redirect permanent /olduser/other/
Redirect permanent /olduser/other/sub/
Redirect permanent /olduser/

Of course the first line is problematic, since I am redirecting in the last line the whole subdirectory to the new domain. On the new domain I don’t have privileges, as it is a static website similar to GitHub.

Note that I cannot simply use a rewrite rule, as the old directories don’t correspond to new files/dirs. Or better, I cannot see how I can do this 🙂

How can I make the /olduser/exception/ work on the old server, without affecting the other rules?


Simply like this:

RedirectMatch ^/olduser/(?!exception/).*

Instead of:

Redirect permanent /olduser/

Will redirect all /olduser request exept pattern matching /olduser/exception/ to your new domain.

Leave a Reply

Your email address will not be published.