naik.apoorv Posted November 7, 2010 Share Posted November 7, 2010 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 . Quote Link to comment https://forums.phpfreaks.com/topic/217998-redirecting-url-of-one-server-to-another-while-masking-the-new-url/ Share on other sites More sharing options...
cags Posted November 7, 2010 Share Posted November 7, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/217998-redirecting-url-of-one-server-to-another-while-masking-the-new-url/#findComment-1131438 Share on other sites More sharing options...
naik.apoorv Posted November 7, 2010 Author Share Posted November 7, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/217998-redirecting-url-of-one-server-to-another-while-masking-the-new-url/#findComment-1131441 Share on other sites More sharing options...
cags Posted November 8, 2010 Share Posted November 8, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/217998-redirecting-url-of-one-server-to-another-while-masking-the-new-url/#findComment-1131898 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.