masking a domain with a subdomain

Using a single web hosting account to host multiple sites

masking a domain with a subdomain

Postby talohec » Sat Jan 10, 2009 5:05 am

I need to mask the url of the French version of my site.

My site is http://www.findmybusiness.biz and its French version is

http://www.findmybusiness.biz/index.php?lang_code=3


And what I want to do is to redirect the following subdomain

http://www.quebeccommerceavendre.findmybusiness.biz
to http://www.findmybusiness.biz/index.php?lang_code=3

but it should look like
http://www.quebeccommerceavendre.findmybusiness.biz/index.php?lang_code=3

and it doesn't

What can I do?
talohec
 
Posts: 6
Joined: Fri Jan 09, 2009 3:03 pm

Postby richardk » Sat Jan 10, 2009 3:25 pm

What are you using for the current redirect?
What is findmybusiness.biz's document root?
What is quebeccommerceavendre.findmybusiness.biz's document root?

but it should look like
quebeccommerceavendre.findmybusiness.biz/index.php?lang_code=3

You could probably remove ?lang_code=3, if you want to.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby talohec » Tue Jan 13, 2009 2:56 am

for the current redirect, I'm just using the setup from my registrar in cpanel.

regarding the findmybusiness.biz's document root, I guess it's home/find/public_html

and for quebeccommerceavendre.findmybusiness.biz is
quebeccommerceavendre.findmybusiness.biz's


Finally, it would be good if we can take off the lang_code from the url, but it should be redirected to lang_code=3 anyways

Thank you
talohec
 
Posts: 6
Joined: Fri Jan 09, 2009 3:03 pm

Postby talohec » Tue Jan 13, 2009 2:58 am

Sorry, for quebeccommerceavendre.findmybusiness.biz, the document root is

/home/find/public_html/quebeccommerceavendre

Thanks
talohec
 
Posts: 6
Joined: Fri Jan 09, 2009 3:03 pm

Postby richardk » Tue Jan 13, 2009 2:09 pm

Unfortunately there is no pure mod_rewrite solution to this problem (in .htaccess files) because you can't rewrite outside the (sub domain's) doucment root.

First you should ask your host if they can change the sub domain's document root.

If they can't, you could try creating a Symbolic Link from /home/find/public_html/quebeccommerceavendre to /home/find/public_html.

If you can't do that try this in a .htaccess file in /home/find/public_html/quebeccommerceavendre
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} !^quebeccommerceavendre.findmybusiness.biz$ [NC]
RewriteRule ^(.*)$ http://quebeccommerceavendre.findmybusiness.biz/$1 [R=301,L]

RewriteRule ^(.*)$ http://findmybusiness.biz/$1 [P,L]

It requires that you have mod_proxy available.

Finally, it would be good if we can take off the lang_code from the url, but it should be redirected to lang_code=3 anyways

What do you mean about it being redirected anyway?

Does it only need to be there for the index.php file? If it does, try adding
Code: Select all
RewriteRule ^(index\.php)?$ http://findmybusiness.biz/index.php?lang_code=3 [P,L]

before
Code: Select all
RewriteRule ^(.*)$ http://findmybusiness.biz/$1 [P,L]

If not, replace
Code: Select all
RewriteRule ^(.*)$ http://findmybusiness.biz/$1 [P,L]

with
Code: Select all
RewriteRule ^(.*)$ http://findmybusiness.biz/$1?lang_code=3 [P,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Getting closer

Postby talohec » Tue Jan 13, 2009 2:30 pm

wow, it works very well, but somehow the www. is not there and the page doesnt deploys properly... it looks weird.

I dont know if I should install something else in that folder to make it look normal.

compare:

http://www.findmybusiness.biz

and

http://www.quebeccommerceavendre.findmybusiness.biz

By the way, I really appreciate your help on this
talohec
 
Posts: 6
Joined: Fri Jan 09, 2009 3:03 pm

Postby richardk » Tue Jan 13, 2009 2:37 pm

You're using the mod_rewrite with mod_proxy, right? The problem with that is it's slow and that is why your images are not loading (if you refresh a bit, or visit the image directly it works).

Have you contacted your host about this?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby talohec » Tue Jan 13, 2009 2:45 pm

Yes, I asked to my host to install mod_proxy few days ago and its done

is there any other way to make it faster?
talohec
 
Posts: 6
Joined: Fri Jan 09, 2009 3:03 pm

Postby richardk » Wed Jan 14, 2009 8:49 am

Not that i know of.

You could change the image, CSS, etc. links to reference the main domain and not the sub domain. Then it would load quicker.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby talohec » Wed Jan 14, 2009 12:55 pm

Thanks you anyways
talohec
 
Posts: 6
Joined: Fri Jan 09, 2009 3:03 pm


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 22 guests

cron