:: EDIT ::

How to setup wildcard subdomains and then rewrite the adress?

directory structure

/var/www/domain.com        // .htaccess with rewrite rules is placed here
/var/www/domain.com/_admin
/var/www/domain.com/_admin/tst
/var/www/domain.com/_files
/var/www/domain.com/_mysql

.htaccess

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

when you request http://admin.domain.com/tst the adress is rewritten to http://admin.domain.com/_admin/tst

how to fix it so /_admin is hidden?

link|improve this question

69% accept rate
could anyone help? – clarkk May 25 '11 at 12:23
feedback

1 Answer

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 domain.com/page to www.domain.com/page instead of www.domain.com/domain.com/page, which seems sensible, remove this block:

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

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.