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.

Context: How can I configure a NameCheap domain to point to an Apache subfolder?


Following Devin's answer here I've created a .htaccess file in /var/www and wrote in the following:

RewriteEngine On

RewriteCond !sergiotapia.me
RewriteRule (.*) sergiotapia.me/$1 [QSA]

My folder structure is such:

/var/www/
/var/www/sergiotapia.me

When visiting the URL sergiotapia.me I see the contents of /var/www when I would like to be directly redirected to /var/www/sergiotapia.me

Any ideas?

share|improve this question
add comment

3 Answers

From your question, i think you don't need to use rewrites here, but you should change your DocumentRoot within your VirtualHost block to point to the right directory. So for instance:

<VirtualHost sergiotapa.me>
...
DocumentRoot /var/www/sergiotapia.me
...
</VirtualHost>
share|improve this answer
add comment

A . in a regular expression is a special character (it means "any character except \n"), so you'll need to escape it.

Try:

RewriteEngine On

RewriteCond !sergiotapia\.me
RewriteRule (.*) sergiotapia\.me/$1 [QSA]
share|improve this answer
    
It still doesn't redirect despite escaping the regex. Do you think I need to restart the Apache service first? Edit: Restarted service and still no dice. :( –  Serg Nov 18 '12 at 21:07
add comment

Check your virtual host configuration for AllowOverride (Probably within a section).

If AllowOverride is None .htaccess is not parsed. Set it to All might help...

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.