Multiple Websites, One UserProfile

Using a single web hosting account to host multiple sites

Multiple Websites, One UserProfile

Postby DerTobi75 » Fri Apr 25, 2008 2:24 pm

Hi,

I have been looking around here and did not find the right solution for my problem!

I have three websites (domainA.com, domainB.com and domainC.com), all of them share the same userdatabase. By default, when someone wants to visit a usersprofile he can see it at domainA.com/user/XYprofile, domainB.com/user/XYprofile and also at domainC.com/user/XYprofile. So, domainB and domainC should redirect to domainA.

When a user wants to edit his profile, the url looks like domainA.com/user/XYprofile/edit !

Can you please help me, I did not get it?!

Regards,

Tobi
DerTobi75
 
Posts: 5
Joined: Fri Apr 25, 2008 2:15 pm

Postby richardk » Sat Apr 26, 2008 2:55 pm

So you want to redirect domainB.com/user/* and domainC.com/user/* to domainA.com/user/*?

Try the following in /user
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?domainA\.com$ [NC]
RewriteRule ^(.*)$ http://www.domainA.com/user/$1 [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby DerTobi75 » Sat Apr 26, 2008 5:31 pm

Hi,

thanks for your answer. But this does not work :(

The correct link to the profile looks like domainA.com/?q=user/1

The /user/1 was a rewrite rule by drupal and there are also the following rewrite rules in my htaccess!

RewriteCond %{HTTP_HOST} ^www\.domainA\.com$ [NC]
RewriteRule ^(.*)$ http://domainA.com/$1 [L,R=301]
(three times, for domain a to c, this is a drupal multisite setup!)

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Regards,

Tobi
DerTobi75
 
Posts: 5
Joined: Fri Apr 25, 2008 2:15 pm

Postby richardk » Tue Apr 29, 2008 9:38 am

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} !^domainA\.com$ [NC]
RewriteRule ^user(/(.*))?$ http://domainA.com/user/$2 [R=301,L]

RewriteCond %{HTTP_HOST} ^www\.(domainA\.com|domainB\.com|domainC\.com)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?q=$1 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby DerTobi75 » Tue Apr 29, 2008 11:41 am

RichardK,

thank you so very much! That did the trick! Wow, never thought that I got that "feature" to my sites...

Thank you,

Tobi
DerTobi75
 
Posts: 5
Joined: Fri Apr 25, 2008 2:15 pm

Postby DerTobi75 » Fri Jun 06, 2008 3:06 pm

Hi Richard,

I ran into some new problems! Maybe you now an answer, would be great ;)

I am still working on the same setup where you helped me with the rewrite rules. But now, I have a fourth domain, where the following urls should not redirect to domainA, but to domainD: login, register & password!

So e.g. domainA[B,C,D]/user/login should redirect to domainD/user/login or domainA[B,C,D]/user/password also to domainD/user/password but domainD[C,B,A]/user/username to domainA/user/username!

Any chance to realise this?!

Regards,

Tobi
DerTobi75
 
Posts: 5
Joined: Fri Apr 25, 2008 2:15 pm

Postby richardk » Mon Jun 09, 2008 12:49 pm

So you want all requests to /user/login and /user/password to go to domainD, but /user/username to go to domainA? Then try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} !^domainD\.com$ [NC]
RewriteRule ^user(/(password|login)/?)?$ http://domainD.com/user/$2 [R=301,L]

RewriteCond %{HTTP_HOST} !^domainA\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/user/(password|login)/?$ [NC]
RewriteRule ^user(/(.*))?$ http://domainA.com/user/$2 [R=301,L]

RewriteCond %{HTTP_HOST} ^www\.(domainA\.com|domainB\.com|domainC\.com)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?q=$1 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby DerTobi75 » Tue Jun 10, 2008 10:29 am

And again, thank you very much Richard, works like a charme!

Is there a way to support you!?!
DerTobi75
 
Posts: 5
Joined: Fri Apr 25, 2008 2:15 pm


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 22 guests

cron