: How to generically forward an URL from one toplevel domain to another? if I own a domainname myweb.com with corresponding hosting, and I also own a domain myweb.net (but no webhosting is setup
if I own a domainname myweb.com with corresponding hosting, and I also own a domain myweb.net (but no webhosting is setup for this domain), is there a way that I can generically forward myweb.net/anyURL to myweb.com/anyURL, and if so, how can this be done?
More posts by @Rambettina238
2 Comments
Sorted by latest first Latest Oldest Best
Redirecting a domain name to another (including deep links redirecting to deep links) is a very common setup. In fact most redirect rules that you can implement redirect deep links to deep links by default. It is generally harder to set up a redirect that redirects everything to the front page of another site.
Most domain name registrars offer this service free of charge. For example GoDaddy calls this "Forwarding" and it is available under the "Domain Settings" for the domain. I just checked one of my domains that is set up this way and confirmed that deep links do in fact forward to deep links on the other domain.
If your web host uses cPanel to allow you to set up your domains, the feature is also called forwarding. See the cPanel documentation on forwarding.
If you have an Apache virtual host set up for the domain that you want to redirect, you can edit your .htaccess or httpd.conf file and put in a redirect rule. Apache redirect rules behave like you want, they forward deep links to deep links.
Redirect permanent / example.com/
Finally, if you have both domains being served from a single directory on the server, you can use rewrite rules to redirect one domain to the other. This is the only case in which you have to do something special to get the deep links. The (.*) is a capturing group that is put onto the URL with the :
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.org$ [NC]
RewriteRule ^(.*)$ example.com/ [L,R=301]
Or alternately, redirect anything that isn't example.com to example.com (which handles subdomains and multiple redirect domains in one command):
RewriteEngine On
RewriteCond %{HTTP_HOST} !^example.com$ [NC]
RewriteRule ^(.*)$ example.com/ [L,R=301]
It sounds like what you want to do is domain mirroring, or do you just want to forward from one URL to another?
If you're looking to forward domains, you would want to look at the DNS settings where you registered your domain, or look to see if you have a control panel where you can manage domains and redirections.
If you just want to forward to an external link, you can do this through a plugin, or using an HTML redirection: stackoverflow.com/questions/5411538/how-to-redirect-from-an-html-page
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.