Reputation: 299
I've a problem and hope u can help me whit this.
-I've multiple domains looking to the same IP.
-I've made rewriterules in htaccess but they change the URL to :
website1.nl/website1/index.php
-root looks like
-web
-website1
-index.php
-website2
-index.php
-Iff i put the index.php in the root (map :web) i get a clean URL just "website1.com" and no index.php
here's mine question : How can i change this is htaccess whitout changing the URL?
what i get this far but isn't working is:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?website1\.com$ [NC]
RewriteRule ^(.*)$ website1/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^(www\.)?website2\.com$ [NC]
RewriteRule ^(.*)$ website2/$1 [R=301,L]
I hope somebody can help me??????
Upvotes: 1
Views: 50
Reputation: 784918
You can use these 2 rules in root .htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?website1\.com$ [NC]
RewriteRule ^((?!website1/).*)$ website1/$1 [NC,L]
RewriteCond %{HTTP_HOST} ^(www\.)?website2\.com$ [NC]
RewriteRule ^((?!website1/).*)$ website2/$1 [NC,L]
Upvotes: 1