Jump to content

Redirecting url of one server to another while masking the new url


naik.apoorv

Recommended Posts

Hey I m a newbie in configuring the .htaccess files.

Actually i need to redirect certain url patterns of my website to another website

 

Ex:

 

myurl : http://dl1.abc.com/<some query string>

newurl: http://dl1.xyz.com/<same string as above>

 

Can anyone help me out here ? I m so messed up with it .

Also I need to know that can this redirection process be transparent to the end user , like, when he enter a link

 

http://dl1.abc.com/<something> the redirection occurs but the url visible to the user is

still

http://dl1.abc.com

 

currently i'm using the following code

 

RewriteEngine on

RewriteCond %{HTTP_HOST} ^http://dl1.abc.com$

RewriteRule ^(.*)$ http://dl1.xyz.com/$1 [R=301,L]

 

Is the code correct or it needs some modifications ?

Please provide a sample code .

 

It's not possible. You can't redirect to a page on another domain and have the original domain still displayed in the address bar. Imagine the security implications this would have.

 

Ok, I get it no problems with that . But how can I redirect my url to another url with the same parameters. Can u help me on that ?

The remote url returns a file for download , I need that my url redirects to the remote one and provides the same download.

 

Thnks for replying

The RewriteRule you have have looks more or less correct. The HTTP_HOST value is probably 'dl1.abc.com' though, I don't believe it includes the protocol. Thus your RewriteCond is not matching. Assuming only one URL points at the file containing the .htaccess you can just remove the RewriteCond, otherwise you should just need to remove the protocol part.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.