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 have my site at www.example.com and have several sub-domains city wise. Suppose i have subdomain with name say "subdomain.example.com" then i want to redirect the subdomain homepage to directory in same subdomain like "subdomain.example.com/browse/city/" so whenever user try to browse "subdomain.example.com" it will get redirect to "subdomain.example.com/browse/city/"

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 "subdomain.example.com" to "subdomain.example.com/browse/city/" 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

1 Answer 1

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

 
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.