Mobile app version of vmapp.org
Login or Join
Miguel251

: Is it possible to use domain forwarding with masking without the use of iframe? I never noticed this before, but one of my sites has domain forwarding with masking enabled, which is adding

@Miguel251

Posted in: #Domains #Masking

I never noticed this before, but one of my sites has domain forwarding with masking enabled, which is adding an iframe to wrap the site. This is bad for SEO and bad for responsive design. Is it possible to forward the domain with masking without using iframes?

My ultimate goal:

I have two domain names:

domain1.com
domain2.com

domain1.com points to site1 on my server (A record).
I wanted to point domain2.com to a page on that same site1. So when I type domain2.com arrive at domain1.com/mypage, but the URL display domain2.com

This works with forwarding with masking, but as I pointed out, that's not a good solution.

UPDATE:

So I have switched things around a bit.

Now I have both domains pointing to the same IP address. In Cpanel I've added the second domain as a parked domain. That way I can navigate the site with either domain without the URL switch up top.

Now this is what I am trying to accomplish:

If the site is accessed via domain2 then the user should be redirected to another page (not the home page). I believe I can accomplish this with htaccess which I know little about. But the idea is to do something similar to this in htaccess;

if(domain2){
//redirect to domain2.com/domain2-page
}else{
//redirect to domain1.com
}

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Miguel251

2 Comments

Sorted by latest first Latest Oldest Best

 

@Margaret670

You could just create another domain as you said, just place all your website there(meaning data - all files), but use the same or a mirrored database additionaly. Depends on how often you update your code, etc, you can just create git repo and auto-pull on change for the other website, just adding a small shell automaticaly renaming string domain1.com to domain2.com, you can accomplish this by awk/sed more and possible solutions can be found here on a StackOverflow question : AWK/SED how to do a recursive find/replace of a string?

10% popularity Vote Up Vote Down


 

@BetL925

You can use A record to point both domains to the same IP address. Then you can configure the webserver to serve both sites from the same directory. Doing so is usually a simple matter of making sure that each virtual host is set to serve content from a common directory.



Your other option is to run a reverse proxy server on your second domain. When somebody hits /page.html on domain2:


The server at domain2 would fetch domain1/page.html
The server at domain2 might rewrite links and cookies to be appropriate for domain2
The server at domain2 would re-serve the content


A reverse proxy will work even when you can't host the sites on the same computer, but it introduces extra processing which can lead to performance problems.



In either case, you are going to have duplicate content problems for search engines. Search engines are going to choose one of your domains to index and ignore the other. It is usually better to redirect one domain to the other. If you can't do that, you should user link rel canonical tags to tell search engines which domain to prefer.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme