Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My site exists I have no need for /forum but I do not want to go through the effort of changing everything. Is there a way I can get Apache to rewrite the URL so that it uses the root instead of /forum?

It's a Django app otherwise I would just 301 and change the document root.


share|improve this question
Are the URLs hardcoded in the application's returned HTML/CSS/JS to the absolute (ie src="/forum/images/resource.jpg") path, or are they relative (ie src="images/resource.jpg")? – Shane Madden Apr 16 '12 at 17:30
images/ Thanks, – NixGuru Apr 16 '12 at 17:42
How are you hosting this? mod_wsgi? – Andrew M. Apr 16 '12 at 17:48

Assuming that the resources are all well-behaved about relative pathing, you should be able to just rewrite the paths.

Try this in the <VirtualHost> section:

RewriteEngine On
RewriteCond !^/forum [NC]
RewriteRule /(.*) /forum/$1 [L,PT]

The RewriteCond is designed to leave alone anything that's requesting a path starting with /forum, instead of sending the request to /forum/forum. It may catch errant hardcoded paths, and keep old links alive.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.