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

I have my site at and have several sub-domains city wise. Suppose i have subdomain with name say "" then i want to redirect the subdomain homepage to directory in same subdomain like "" so whenever user try to browse "" it will get redirect to ""

my site generate the pages and directory virtually, in real its not exist. like in above example "browse" and "city" is virtual directory and its fetched from database and created in real time. How can i redirect "" to "" through htaccess. Please let me know solve this issue, i tried googling it but didn't get anything to solve my problem.

share|improve this question

Unless you have a need to use .htaccess, don't do it.

In the server or <VirtualHost> context, you'll want this:

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

Or in a <Directory> or .htaccess context that applies to the document root:

RewriteEngine On
RewriteRule ^$ browse/city/ [R=301,L]
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.