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

I have www.example.com,my main site is in www.example.com/main First I want to do is to redirect from root(www.example.com) to www.example.com/main,than I want to rewrite url(www.example.com/main) to became www.examle.com Is this posible?Any help will be great.

Also I would like,if user click on the link info,he will go to(www.example.com/info) I would like to rewrite url to(info.example.com)


share|improve this question

1 Answer 1

In the VirtualHost config for www.example.com:

RewriteEngine on

RewriteRule ^/$ /main [R=301,L]
RewriteRule ^/info$ http://info.example.com [R=301,L]
share|improve this answer
Sorry,it does not work for me,I'm doing something wrong.I create .htaccess file,copy you code,and put it in to root dir.Just to make a note,I'm trying this on my website,not on localhost.Thx for response. –  user41117 Oct 23 '10 at 6:22

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.