Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to redirect ipaddress/~username/filename to http://newurl.domain.com/filename using Apache Rewrite. Can anyone point out how to do this and specifically to be able to do it for only one user at a time? Thank you in advance.

share|improve this question
add comment

1 Answer

If you make sure that mod_userdir and mod_rewrite are enabled, as well as then you can achieve that by creating or editing ~username/public_html/.htaccess with the following content:

RewriteEngine On
RewriteRule ^(.*)$ http://newurl.domain.com/$1 [R=301,L]

I believe that you can also achieve the same result without .htaccess, by pasting this configuration snippet inside a <Directory /home/username/public_html> ... </Directory> block, but adding the RewriteBase /~username/ directive as well.

share|improve this answer
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.