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 .

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.