0

I would like to forward all requests for domain.net to domain.com. The forwarding works only for the top level URL, meaning the server redirects domain.net to domain.com.

However, any and all sub-domains requests fails; for example, domain.net/sub/content.html would simply pop a NOT FOUND page. There are many such sub-domains, and links to them have been well-propagated through the past five years. Creating individual forwarding scripts for each and every one of them would be very unproductive.

Is there any way to catch such sub-domain requests for domain.net and simply forward them all to one specific sub-domain page in domain.com?

For example:

domain.net/sub1/content.html => domain.com/netpage/index.html

domain.net/sub2/content.html => domain.com/netpage/index.html

domain.net/* => domain.com/netpage/index.html

Thank you.

EDIT: Both the domains and their contents are on a shared webhost (Site5), running Apache servers.

JohnLee
  • 1
  • 1
  • What is the web server? Apache has various URL rewriting modules available, for example. – thrig Aug 26 '15 at 16:20
  • Those are not subdomains, but subfolders under the same domain (just a definition problem) The solution will be different depending on which daemon/service are you running the requests. Apache? Nginx? IIS? Ligthttpd?... – ignivs Aug 26 '15 at 16:20
  • Hello, and thank you for the quick replies. It's a shared web host running Apache. – JohnLee Aug 26 '15 at 16:36
  • And yes, they're in subfolders, but each needs to be redirected to a separate domain; _domain.net_ to _domain.com_. – JohnLee Aug 26 '15 at 16:42

1 Answers1

0

If I understood what you're trying to do correctly and the domains are pointing to the same web server (ip address) then perhaps this solution might be for you?

https://stackoverflow.com/questions/13837978/apache-multiple-sub-domains-with-one-ip-address

Fadi
  • 170
  • 10