redirect via mod_rewrite .htaccess help needed

monchichi

Power Member
Joined
Jun 3, 2011
Messages
624
Reaction score
262
hey guys,

I have set up a hosting which includes 2 domains but the second only as a domain alias. So I need to "split" those domains by htaccess mod:rewrite.

This is what I put into the htaccess:

Code:
RewriteEngine On

RewriteCond %{HTTP_HOST}   ^(www\.)?domainname.com
RewriteCond %{REQUEST_URI} !^/innerfolder
RewriteRule ^(.*)$ innerfolder/$1 [L]

so far so good. It works but in the adress field of the browser it shows domainname.com/innerfolder/ and I want it to show domainname.com only. How can I get that right?
 
Fixed it myself. For anybody interested, it works with this code:

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domainname\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domainname\.com$
RewriteCond %{REQUEST_URI} !^/innerfolder/
RewriteRule (.*) /innerfolder/$1 [L]
 
Back
Top