Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

:: EDIT ::

How to setup wildcard subdomains and then rewrite the adress?

directory structure

/var/www/        // .htaccess with rewrite rules is placed here


RewriteCond %{HTTP_HOST}        ^(admin|files|mysql)\.domain\.com$ [NC]
RewriteCond %{REQUEST_URI}      !^/_(admin|files|mysql)/ [NC]
RewriteRule ^(.*)$               /_%1/$1 [L]

when you request the adress is rewritten to

how to fix it so /_admin is hidden?

share|improve this question
could anyone help? – clarkk May 25 '11 at 12:23

1 Answer 1

up vote 1 down vote accepted

The behaviour you report seems to follow your configuration closely. What is the expected result that you're not getting?

If you want to redirect to instead of, which seems sensible, remove this block:

RewriteCond %{HTTP_HOST}        ^www\.domain\.com$ [NC]
RewriteCond %{REQUEST_URI}      !^/domain\.com/ [NC]
RewriteRule ^(.*)$          /$1 [L]
share|improve this answer
it's still the same.. you are redirected to – clarkk May 24 '11 at 22:23
I want to rewrite to – clarkk May 24 '11 at 22:44

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.