NotionCommotion Posted November 9, 2008 Share Posted November 9, 2008 Hi, I am having problems with the server hosting my site, and wish to temporarily use another server until the problem has been resolved. I don't want the user to know that they have been redirected, but think they are at the same URL. Also, I can't simply point the domain name to the new server because I must preserve the email going to the original server. For instance, the URL www.site1.com/bla/bla would redirect to www.site2.com/somedirectory/bla/bla, but still display www.site1.com/bla/bla in the users browser. Would using htaccess work? I have tried using the following three .htaccess approaches, but still no success. A request to site1 redirects me to site2 using all three .htaccess approaches, however, the URL in the browser shows site2 and not site1. When I do something similar but make the redirect internal (i.e. don't include the http://), the URL in the browser keeps the original URL. Is it possible to use .htaccess to redirect to another external URL, but keep the original URL in the browsers URL box? If not, is their a non-htaccess way of doing this? THANKS!!! Redirect 302 / http://www.site2.com/somedirectory/ RewriteEngine on RewriteRule ^(.*)$ http://www.site2.com/somedirectory/$1 [NC,L] RewriteEngine on RewriteCond %{HTTP_HOST} ^www\.site1\.com$ [NC] RewriteRule ^(.*)$ http://www.site2.com/somedirectory/$1 [NC,L] Quote Link to comment https://forums.phpfreaks.com/topic/132029-redirecting-with-a-twist/ Share on other sites More sharing options...
corbin Posted November 9, 2008 Share Posted November 9, 2008 The only way I can think of to do this is mod proxy. Quote Link to comment https://forums.phpfreaks.com/topic/132029-redirecting-with-a-twist/#findComment-686059 Share on other sites More sharing options...
NotionCommotion Posted November 9, 2008 Author Share Posted November 9, 2008 Thanks Corbin, Buy using mod_proxy, do you mean using the Proxy flag? RewriteEngine on RewriteRule ^(.*)$ http://www.site2.com/somedirectory/$1 [P NC,L] Or doing something like the following? ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass / http://www.site2.com/somedirectory ProxyPassReverse / http://www.site2.com/somedirectory As you can probably guess, I have know idea how to use proxy, and would appreciate any guidance. Thanks, Michael Quote Link to comment https://forums.phpfreaks.com/topic/132029-redirecting-with-a-twist/#findComment-686087 Share on other sites More sharing options...
corbin Posted November 9, 2008 Share Posted November 9, 2008 Either one of those would work. But, I have a question. If server1 is messed up, why tunnel all of the traffic through it? Your best bet is reconfig'ing DNS and just setting up a mailserver on server2 temporarily. Quote Link to comment https://forums.phpfreaks.com/topic/132029-redirecting-with-a-twist/#findComment-686110 Share on other sites More sharing options...
NotionCommotion Posted November 9, 2008 Author Share Posted November 9, 2008 But, I have a question. The owner of the site has his own email server located in his office. To get his emails going to him, I needed to set up the MX records to point to his email server, and the ISP I normally use wasn't able to provide this. For his site, I switched to another ISP and got the email working, but now am having problems with the Joomla site (they acknowledge they have a bug related to Plesk and Joomla but don't know when it will be fixed). I don't want to take a chance of messing up his email, and wanted a temporary fix until I better understand the situation. Using Proxy should only effect the site and not email, right? Thanks for the help! Quote Link to comment https://forums.phpfreaks.com/topic/132029-redirecting-with-a-twist/#findComment-686118 Share on other sites More sharing options...
NotionCommotion Posted November 9, 2008 Author Share Posted November 9, 2008 I tried both ways but neither worked. Adding the flag [P] resulting in site not being found. Adding the ProxyRequests code to my HTACCESS file resulted in a 500 server error. Any suggestions? Thank you Quote Link to comment https://forums.phpfreaks.com/topic/132029-redirecting-with-a-twist/#findComment-686137 Share on other sites More sharing options...
corbin Posted November 9, 2008 Share Posted November 9, 2008 mod_proxy probably isn't loaded. Edit: I should note by the way that mod_proxy might kill your server. The bandwidth of server1 will shoot way up, and all of the traffic will run through both servers. Quote Link to comment https://forums.phpfreaks.com/topic/132029-redirecting-with-a-twist/#findComment-686160 Share on other sites More sharing options...
NotionCommotion Posted November 9, 2008 Author Share Posted November 9, 2008 Thanks! Can mod_proxy only be added via conf file and not htaccess? Also, will it only effect websites and not email? In regards to bandwidth, it is a very low traffic site. Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/132029-redirecting-with-a-twist/#findComment-686197 Share on other sites More sharing options...
corbin Posted November 9, 2008 Share Posted November 9, 2008 Yeah it can only be added via httpd.conf. And it will only affect the website. Quote Link to comment https://forums.phpfreaks.com/topic/132029-redirecting-with-a-twist/#findComment-686200 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.