B.com domain to A.com/folder domain

Using a single web hosting account to host multiple sites

B.com domain to A.com/folder domain

Postby blackhole » Wed Nov 22, 2006 4:28 pm

I've searched deeply in here and couldnt find a solution for my problem. I know my hosting accepts htaccess because it works with other stuff but I cant solve this problem:

I have an Hosting account: A.com domain
I've redirected (through DNS) B.com to A.com domain

and now B.com domain opens A.com when you try to browse it.

What I want is to redirect B.com to a folder inside A.com, let's say A.com/folder

This redirection should be masked, so A.com is never showned in the status bar or address bar.

Maybe richardk can help me on this,

thanks in advance.
blackhole
 
Posts: 5
Joined: Wed Nov 22, 2006 4:23 pm

Postby richardk » Thu Nov 23, 2006 10:20 am

In a .htaccess file in your document root:
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?B\.com$ [NC]
RewriteRule ^folder(/.*)?$ /folder%{REQUEST_URI} [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby blackhole » Thu Nov 23, 2006 10:27 am

it doesnt work, it takes me back to A.com (index.php) instead of the index.php in A.com/folder

Right now the one that works the best is:

Code: Select all
RewriteCond %{HTTP_HOST} ^www\.B\.com$
RewriteCond %{REQUEST_URI} !^/folder/
RewriteRule ^(.*)$ /folder/$1 [R]


the only problem with this one is that the address in the bar is http://www.B.com/folder/ instead of just http://www.B.com

Do you think there's a solution for my problem, since I dont have root access?
blackhole
 
Posts: 5
Joined: Wed Nov 22, 2006 4:23 pm

Postby richardk » Thu Nov 23, 2006 10:31 am

I missed an !:
Code: Select all
!^folder(/.*)?$
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby blackhole » Thu Nov 23, 2006 10:38 am

still not working,

I even removed the Options +FollowSymLinks thing and nothing

:(
blackhole
 
Posts: 5
Joined: Wed Nov 22, 2006 4:23 pm

Postby richardk » Thu Nov 23, 2006 11:17 am

Try:
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST}   ^(www\.)?B\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/folder(/.*)?$ [NC]
RewriteRule ^(.*)$         /folder/$1    [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby blackhole » Thu Nov 23, 2006 12:51 pm

dont work either :(

I dont have access to /root as I said so I cant check apache's configuration. Hosting belongs to AMEN.

The strange fact is that:

Code: Select all
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.B.com$
RewriteCond %{REQUEST_URI} !^/folder/
RewriteRule ^(.*)$ /folder/$1


works if the main file under /folder is a index.html with an index.php it doesnt work and redirects to index.php in A.com

What do you think that I can do richardk? I'm asking this because AMEN doesnt give support to questions like this.
blackhole
 
Posts: 5
Joined: Wed Nov 22, 2006 4:23 pm

Postby richardk » Thu Nov 23, 2006 2:20 pm

I have no idea what's happening. Whatever is happening it shouldn't be.

Does it work if you have path? Eg. b.com/abc.php?

Try adding -MultiViews to the Options lines.

Then try:
Code: Select all
Options +FollowSymLinks -MultiViews

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?B\.com$ [NC]
RewriteRule ^$ /folder/index.php [QSA,L]

RewriteCond %{HTTP_HOST} ^(www\.)?B\.com$ [NC]
RewriteRule !^folder(/.*)?$ /folder%{REQUEST_URI} [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby blackhole » Thu Nov 23, 2006 4:25 pm

richardk:

this one works with an index.html inside:

Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST}   ^(www\.)?B\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/folder(/.*)?$ [NC]
RewriteRule ^(.*)$         /folder/$1    [QSA,L]


the last one you posted works as long as I redirect it to index.html
If I redirect it to index.php or whatever.php it just goes back to A.com/index.php (and there's no other hidden .htaccess in the target folders)

I'm kinda hopeless right now, since neither an expert like you did find the solution

:(

EDIT: do you think we could find a solution with 2 htaccess files one in A.com and another one in A.com/folder so when htaccess#1 reaches folder it detects htaccess#2 that tells him to read index.php....or will this mess up the redirection?
blackhole
 
Posts: 5
Joined: Wed Nov 22, 2006 4:23 pm

Postby richardk » Fri Nov 24, 2006 10:26 am

If I redirect it to index.php or whatever.php it just goes back to A.com/index.php

That just shouldn't happen. There's nothing in the mod_rewrite that would do that, there must be some other settings (either in a .htaccess file or in the main server configuration).

do you think we could find a solution with 2 htaccess files

I don't see how it could be split up.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 101 guests

cron