Jump to content

Recommended Posts

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]

Link to comment
https://forums.phpfreaks.com/topic/132029-redirecting-with-a-twist/
Share on other sites

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

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!

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.