0

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?

1

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: https://stackoverflow.com/questions/5411538/how-to-redirect-from-an-html-page

0

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.

GoDaddy forwarding


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 / http://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 $1:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.org$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [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 ^(.*)$ http://example.com/$1 [L,R=301]
2
  • What if you want to redirect using a mapping file? For example, domain a has spammy pages with some value but you want to redirect to a new, cleaner domain because, among other things, domain a is a spammy url.<br/>spammydomainname.com/stuffy-seo-url-variation1 spammydomainname.com/stuffy-seo-url-variation2 spammydomainname.com/stuffy-seo-url-variation3 would all redirect to brandeddomain.com/clean-topical-url The same would happen throughout the site for various topics and content. Would implementation vary depending on systems used? These are on Wordpress, Apache, using Network Solutions. – David Garcia Mar 3 '16 at 21:24
  • You could ask that as a new question. The answer is too long for a comment. – Stephen Ostermiller Mar 3 '16 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.