I want to be able to redirect a domain pointed to my webhosting to an external domain.
For example, I have this in my .htaccess:
RewriteCond %{HTTP:
I would like to suggest 2 ways how you can go about redirecting your site to another URL, without changing the domain.
Example 1: Redirect and keep everything after the URL The first option will show all of the same content on one URL as you would another. For example, if you just changed your domain to DomainB.com, but you still have plenty of visitors coming to DomainA.com, you would use this to show them all of the existing content that is located on the new domain, without the need to update both websites. To do this, you would modify your .htaccess file for the domain that your users will go to, and insert these lines of code: RewriteCond %{HTTP_HOST} ^DomainA.com RewriteRule ^(.) http://DomainB.com/$1 [P] If you are using the file manager in cPanel, be sure that you have the option to show hidden files selected. What does the above redirect do? After adding this line into your .htaccess file, you will be able to go to DomainA.com/YourPage and it will show the content from DomainB.com/YourPage*
Example 2: Redirect a domain to a specific url There is another way you can do your redirect to show a specific URL, but keep the domain the same as well. If you want visitors to go to DomainA.com with a specific page in mind when doing so, you may use this code:
RewriteCond %{HTTP_HOST} ^DomainA.com RewriteRule ^(.) http://DomainB.com/PathToPageHere [P]*
*You would use this method if, for example, you had an external blog such as one on blogspot.com or maybe a shopping cart on etsy.com that you want people to visit your domain without fully hosting the domain there. Now, visitors can access your site using your domain, but see the content of an external URL. Example 3 Re-directing an IP address Occasionally, there will be a request to re-direct an IP address to a specific URL. The following code shows how this can be done in the .htaccess file.
RewriteCond %{HTTP_HOST} ^##.##.##.## RewriteRule (.) http://domain_name.com/$1 [R=301,L]
Bit long ago, but I'll answer the question anyway for those who come here by Google (like me). The answer is really simple:
In your htaccess, remove the R=301 part (and the comma of course).
R=301 means you do it via a 301 redirect. You don't want that
None of the other answers suggested this. What op is looking for is mod-proxy . You can proxy the request from your domainA to domainB using P flag of mod-rewrite.
RewriteRule ^(.*)$ http://domainB.com/$1 [P]
This will internally redirect all requests from domainA to domainB.
Make sure mod-proxy is enabled on your server.
Maybe you can achieve this by changing the DNS for your domain mydomain.net to link to myexternal.net. Then, you have to use an appropriate .htaccess
on your external server.
Either a single frame frameset, or an iframe with width/height set to 100%.
I'm not sure if framsets are supported in newer versions of HTML, but browsers still understand old versions anyway... but a single iframe is easy anyway.
<html>
<head>
<title>My Site</title>
<style>
body {
margin: 0;
padding: 0;
}
body, iframe {
width: 100%;
height: 100%;
}
iframe {
border: 0;
}
</style>
</head>
<body>
<iframe src="http://example.com" />
</body>
</html>