I have a Domain registered in GoDaddy say xyz.com, (URL1)and another host website say xyz.abc.com (URL2)!
I want to redirect URL1 to page to URL2 using forward feature permanent 301 in Domain registrar portal.
Forward with masking is not working in Mobile phone’s browsers, whereas it is working in Desktop browsers. Normal forward (without masking) is working but I don’t want the URL to change to URL2
Please share exact .htaccess file code to copy and keep in hosting website folder that will restore the URL to URL1 and not show URL2 instead after being forwarded.
Further will there be any difference of such .htaccess files if host server is nginix and or Apache. If so need .htaccess code for both version
So you want to just 301 the old domain to the new one? It would be better to just add the old domain here as a parked domain to the new one, but it you really want to use .htaccess, see below.
Add this .htaccess to the original website:
301 oldpage.html https://newsite.com/newpage.html
Also, Forwarding with masking is not a great idea, please see the topic below to learn more about that.
InfinityFree servers use both NGINX and Apache configurations, however, NGINX does not support .htaccess, which is why we also use Apache.
Using 301 redirects in .htaccess will always redirect URL1 to URL2 and show URL2 to the users.
There’s not a way to mask it using 301 redirects because the point of doing it is exactly the opposite.
A 301 redirect not only redirects users to another URL but also informs search engines that the new URL is the correct one and that they should forget the old URL.