Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I want to redirect the URL:

http://example.com/site to http://example.com/~username/site

I have the following in my httpd.conf file:

RewriteEngine on
RewriteRule ^/site/(.*) /~username/site/$1 [PT]

but this does not seem to be working. It tries to look for /site under /var/www/site/ and fails. What am I doing wrong? FYI, I have also tried with:

RewriteRule ^/site/(.*)$ /~username/site/$1 [PT]
share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted
RewriteEngine on
RewriteRule ^/site/(.*) /~username/site/$1 [PT]

That code should be going into .htaccess, not httpd.conf. Try that, and it should fix your issue.

share|improve this answer
    
This worked. Thanks! –  K G Apr 8 at 12:02
add comment

Your Answer

 
discard

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.