Showing results for 
Search instead for 
Did you mean: 

Apache RewriteRule

Valued Contributor

Apache RewriteRule

Looking for some help with what I would have though was a simple RewriteRule, but this is the first time I've had to do it.

A few sites we have are all under a single context root, so:

I want users to be able to hit and be forwarded. If this can be done without changing the URL in the browser then even better.

I've got as far as:

RewriteRule ^/(.*)$ /root/$1 [PT]

This redirects the first page fine, but if you hit any links in the web page they obviously still have the original context root, so this rule adds /root to it again, and the page cannot be found: becomes and 404s.

I'm obviously missing something fundamental but mod-rewrite seems like a mine field.