Domain Redirecting without changing address in address bar

Using a single web hosting account to host multiple sites

Domain Redirecting without changing address in address bar

Postby hamsaffar » Tue Oct 21, 2008 8:56 am

Hello,

I have 2 domains. I want to redirect :"http://mydomain1.com" to "http://mydomain2.com/index.php/page,NewsUser.NewsList/CatID,125" without changing the address in address bar.
In other word I want when a user typed : "http://mydomain1.com" see the page of "http://mydomain2.com/index.php/page,NewsUser.NewsList/CatID,125" but with address :"http://mydomain1.com" in address bar.
(The dns of both of domains set on a same server and the control panel is: cPanel)

Would you please help and guide me?

Yours Sincerely,
Best Regards,
Hamsaffar
hamsaffar
 
Posts: 2
Joined: Tue Oct 21, 2008 7:33 am

Postby richardk » Tue Oct 21, 2008 9:46 am

Does cPannel allow you to set the domain as an add-on domain of the main domain so that the document roots are the same?

Then you could try the following in a .htaccess file in your document root
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?example1\.com$ [NC]
RewriteRule ^$ /index.php/page,NewsUser.NewsList/CatID,125 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby hamsaffar » Tue Oct 21, 2008 11:26 pm

Hello,

Yes, I have access to cpanel & WHM.
I added "mydomain1.com" to "mydomain2.com" in addon domains.
and I add the bellow lines to the .htaccess file as you suggest:
--------------------------------------------------------
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?mydomain1\.com$ [NC]
RewriteRule ^$ /index.php/page,NewsUser.NewsList/CatID,125 [QSA,L]
--------------------------------------------------------

but it shows the first page of "mydomain2.com"

In addon domains in cpanel there are 4 items:
1- New Domain Name: (i entered : "mydomain1.com")
2- Subdomain/Ftp Username: (i entered : "domain1" as username)
3- Document Root: (i entered: "/public_html" )
4- Password: ( I entered a password)


So, What is the problem?
Would you please guide me.

Yours Sincerely,
Best Regards,
Hamsaffar
hamsaffar
 
Posts: 2
Joined: Tue Oct 21, 2008 7:33 am

Postby richardk » Wed Oct 22, 2008 7:08 am

Your add-on domain configuration sounds correct.

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain1\.com$ [NC]
RewriteRule .* /index.php/page,NewsUser.NewsList/CatID,125 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby SilviuB » Mon Nov 24, 2008 10:22 am

I have the same problem and didn't manage to resolv it.

I have subdomain.domain1.com on a shared host and subdomain.domain2.com on another shared host.

What i want is for subdomain.domain2.com to redirect to subdomain.domain1.com, but also in the adress bar to remain subdomain.domain2.com. How do i do this ?
SilviuB
 
Posts: 1
Joined: Mon Nov 24, 2008 9:52 am

Postby richardk » Mon Nov 24, 2008 1:04 pm

The only way to do that is to use mod_proxy (via mod_rewrite).

In subdomain.domain2.com's document root
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^(.*)$ http://subdomain.domain1.com/$1 [P,L]

This will use both hosts bandwidth and transfer, though.
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 4 guests

cron