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

We are on a Network Solutions VPS, four domains all one IP.

In vhost.config file for a single domain, the following will work:

Redirect 301 /1234

But the following 3 rewrites will not work:

RewriteEngine On
RewriteRule ^1234$ / [R=301,L]

Options +FollowSymlinks 
RewriteEngine On
RewriteRule ^1234$ / [R=301,L]

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^1234$ [R=301,L]

These are just tests to get something more serious done with mod rewrite in vhost.config. I feel like I must just be missing something simple. If anyone can help me out, it would be greatly appreciated.

share|improve this question
Have you tried adding a leading slash? i.e., RewriteRule ^/1234$? – Andrew M. Apr 1 '11 at 12:14
Why would I try that ? :) Seriously thanks, works like a charm, and I appreciate the help. – kidcobra Apr 1 '11 at 18:01
Yeah, Apache can be a little weird... it doesn't explicitly say it in the docs, but its one of those "gotchas" that only makes sense AFTER you figure it out. :) I added this as an answer so you can resolve the question. – Andrew M. Apr 2 '11 at 2:29

Adding answer from my comment. Adding a leading slash makes it match the full path from the base, as opposed to a path component.

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.