multiple domain - 1 hosting account

Using a single web hosting account to host multiple sites

multiple domain - 1 hosting account

Postby gertje8 » Tue May 19, 2009 6:11 am

Hello,

I have a problem.

I have multiple domains under one account.

maindomain.nl -> Is main account ( really the .nl extension...... )
addondomain.com -> addon domain ( really the .com extension...)
anotheraddondomain.com -> addon domain 2 ( also .com extension... )

The structure of my account would looks like this:

/public_html/ -> maindomain

/public_html/addon_domain/ -> addon domain

/public_html/anotheraddon_domain/ -> addon domain 2

This is my .htaccess

RewriteEngine On

#Rule-0
RewriteCond %{HTTP_HOST} ^addondomain.com$
RewriteCond %{REQUEST_URI} !^/addon_domain/
RewriteRule (.*) /addon_domain/$1

#Rule-1
RewriteCond %{HTTP_HOST} ^anotheraddondomain.com$
RewriteCond %{REQUEST_URI} !^/anotheraddon_domain/
RewriteRule (.*) /anotheraddon_domain/$1

When some is clicking a link on addondomain.com or the other domains to a subdir of the domain the url in the browser window is displayed correctly.

( link is like : http://www.addondomain.com/link/index.php )

When I / someone is typing the url and hits the enter button the url in the browser is displayed like :

http://www.maindomain.nl/addon_domain/link/index.php :-?

is there a way so when someone else type addondomain.com/link/index.php ( or other files ) into the address bar it'll stay same like that without anyone seeing that its a subdirectory of a maindomain?
gertje8
 
Posts: 9
Joined: Tue May 19, 2009 5:54 am

Postby richardk » Tue May 19, 2009 3:45 pm

When I / someone is typing the url and hits the enter button the url in the browser is displayed like :

http://www.maindomain.nl/addon_domain/link/index.php

What are you typing in the address bar exactly?

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

# Add missing trailing slashes.
RewriteCond %{HTTP_HOST}/addon_domain ^(www\.)?addondomain\.com(/addon_domain)$ [NC,OR]
RewriteCond %{HTTP_HOST}/anotheraddon_domain ^(www\.)?anotheraddondomain\.com(/anotheraddon_domain)$ [NC]
RewriteCond %{DOCUMENT_ROOT}%1%{REQUEST_URI}/ -d
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST}/addon_domain ^(www\.)?addondomain\.com(/addon_domain)$ [NC,OR]
RewriteCond %{HTTP_HOST}/anotheraddon_domain ^(www\.)?anotheraddondomain\.com(/anotheraddon_domain)$ [NC]
RewriteRule ^(.*)$ %1/$1 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby gertje8 » Tue May 19, 2009 9:16 pm

richardk wrote:
When I / someone is typing the url and hits the enter button the url in the browser is displayed like :

http://www.maindomain.nl/addon_domain/link/index.php

What are you typing in the address bar exactly?

--> cut


Seems like it doesn't work...
The addon domains are redirecting to the main domain. with this code.

I will try to explain the problem a little better.

When someone is typing

http://www.addon_domain.com/linkex/

and hits the enter button, the url in the adress bar is becoming :

http://www.maindomain.nl/addon_domain/linkex/index.php

There is a link exchange script on the site. Maybe that's causing the problem?

About the code...
I don't understand why i don't see a url of the main domain what is being rewrited.

In my opinion i need something like this..... but is also not working.

# Add missing trailing slashes.
RewriteCond %{HTTP_HOST}/addon_domain ^(www\.)?maindomain\.nl
(/addon_domain)$ [NC]

# /addon_domain is the directory in public_html where the files for the extra domain are being upload.

RewriteCond %{DOCUMENT_ROOT}%1%{REQUEST_URI}/ -d
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST}/addon_domain ^(www\.)?addondomain\.com$ [NC]
RewriteRule ^(.*)$ %1/$1 [QSA,L]

I really appreciate your advice! :D
gertje8
 
Posts: 9
Joined: Tue May 19, 2009 5:54 am

Postby richardk » Wed May 20, 2009 8:26 am

There is a link exchange script on the site. Maybe that's causing the problem?

Does it redirect at all?

About the code...
I don't understand why i don't see a url of the main domain what is being rewrited.

The mod_rewrite sends requests to addondomain.com to /addon_domain.

You could add
Code: Select all
RewriteCond %{HTTP_HOST} ^(www\.)?maindomain\.nl$ [NC]
RewriteRule ^addon_domain(/(.*))?$ http://www.addondomain.com/$2 [R=301,L]

RewriteCond %{HTTP_HOST} ^(www\.)?maindomain\.nl$ [NC]
RewriteRule ^anotheraddon_domain(/(.*))?$ http://www.anotheraddondomain.com/$2 [R=301,L]

before
Code: Select all
# Add missing trailing slashes.

to redirect maindomain.nl/addon_domain to addondomain.com.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby gertje8 » Wed May 20, 2009 9:04 am

richardk wrote:
There is a link exchange script on the site. Maybe that's causing the problem?

Does it redirect at all?

About the code...
I don't understand why i don't see a url of the main domain what is being rewrited.

The mod_rewrite sends requests to addondomain.com to /addon_domain.

You could add
Code: Select all
RewriteCond %{HTTP_HOST} ^(www\.)?maindomain\.nl$ [NC]
RewriteRule ^addon_domain(/(.*))?$ http://www.addondomain.com/$2 [R=301,L]

RewriteCond %{HTTP_HOST} ^(www\.)?maindomain\.nl$ [NC]
RewriteRule ^anotheraddon_domain(/(.*))?$ http://www.anotheraddondomain.com/$2 [R=301,L]

before
Code: Select all
# Add missing trailing slashes.

to redirect maindomain.nl/addon_domain to addondomain.com.


With the code you gave everything is redirecting to my main domain.

Maybe a very brutal question... but is it possible to send you the real url in a private message? So you can see what's happening.
gertje8
 
Posts: 9
Joined: Tue May 19, 2009 5:54 am

Postby richardk » Wed May 20, 2009 5:10 pm

With the code you gave everything is redirecting to my main domain.

Everything? Including requests to addondomain.com?

is it possible to send you the real url in a private message? So you can see what's happening.

Ok.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby gertje8 » Sun May 24, 2009 11:18 am

Looks like the problem is caused by a php script. When I have the solution I will post it here..

After my experience with this forum, it gave it a special place :D

Thnx richardk!
gertje8
 
Posts: 9
Joined: Tue May 19, 2009 5:54 am

Postby gertje8 » Fri May 29, 2009 12:08 am

Hello all,

My problem is solved by adding the next to the .htacces file.

RewriteRule ^/*(.+/)?([^.]*[^/])$ http://%{HTTP_HOST}/$1$2/ [L,R=301]

G.
gertje8
 
Posts: 9
Joined: Tue May 19, 2009 5:54 am

Postby richardk » Fri May 29, 2009 9:44 am

Only when there was no slash ( / ) at the end of the url the url was changing in the domain/subdirectorie of my main account.

There is an error with my mod_rewrite, the following should work without anything extra
Code: Select all
Options +FollowSymLinks

RewriteEngine On

# Add missing trailing slashes.
RewriteCond %{HTTP_HOST}/addon_domain ^(www\.)?addondomain\.com(/addon_domain)$ [NC,OR]
RewriteCond %{HTTP_HOST}/anotheraddon_domain ^(www\.)?anotheraddondomain\.com(/anotheraddon_domain)$ [NC]
RewriteCond %{DOCUMENT_ROOT}%2%{REQUEST_URI}/ -d
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST}/addon_domain ^(www\.)?addondomain\.com(/addon_domain)$ [NC,OR]
RewriteCond %{HTTP_HOST}/anotheraddon_domain ^(www\.)?anotheraddondomain\.com(/anotheraddon_domain)$ [NC]
RewriteRule ^(.*)$ %2/$1 [QSA,L]

(It includes "Add missing trailing slashes".)
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby gertje8 » Fri May 29, 2009 10:53 am

richardk wrote:
Only when there was no slash ( / ) at the end of the url the url was changing in the domain/subdirectorie of my main account.

There is an error with my mod_rewrite, the following should work without anything extra
Code: Select all
Options +FollowSymLinks

RewriteEngine On

# Add missing trailing slashes.
RewriteCond %{HTTP_HOST}/addon_domain ^(www\.)?addondomain\.com(/addon_domain)$ [NC,OR]
RewriteCond %{HTTP_HOST}/anotheraddon_domain ^(www\.)?anotheraddondomain\.com(/anotheraddon_domain)$ [NC]
RewriteCond %{DOCUMENT_ROOT}%2%{REQUEST_URI}/ -d
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST}/addon_domain ^(www\.)?addondomain\.com(/addon_domain)$ [NC,OR]
RewriteCond %{HTTP_HOST}/anotheraddon_domain ^(www\.)?anotheraddondomain\.com(/anotheraddon_domain)$ [NC]
RewriteRule ^(.*)$ %2/$1 [QSA,L]

(It includes "Add missing trailing slashes".)


I'm going to try if it this also works and will report back to you.
gertje8
 
Posts: 9
Joined: Tue May 19, 2009 5:54 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 18 guests

cron