Is there a way I could achieve redirecting to another site, without losing the original URL?
So, what we'd want to achieve is to be able to access:
somesite.com/some/url -> someothersite.com/some/url
but we'd like to retain somesite.com/*.
In other words, we'd want to access every URL of someothersite.com via somesite.com.
|
| ||||
|
feedback
|
|
Are you actually looking for a redirect, or to have that other site's content appear under your original URL (more proxying)? I'll assume that the other server is your content and either internal/backend or if public you're aware of the negative SEO implications. If someothersite.com is not your site and content, you probably shouldn't be doing this. You'll need to have mod_proxy and mod_rewrite running, which is likely uncommenting the lines mentioning it if not already done. Then in the somesite.com config: | |||
|
feedback
|
|
If you're trying to redirect just a subdirectory of the server, you can use mod_rewrite like this:
If your trying to show the content of the other site without the user seeing the other url, you'll need both mod_rewrite and mod_proxy
Other configuration steps may be necessary for mod_proxy, depending on your environment. Apache's Advanced mod_rewrite Guide may be of benefit. | |||
|
feedback
|
|
I'd just throw in a file that simply redirects the user with an HTML meta-refresh, or if you want to redirect the user in the most accepted way possible, throw in a 301 redirect rule in an .htaccess file somewhere on the site. Example:
| |||||||
feedback
|