I am trying to use htaccess to redirect ALL pages from a domain to a specific page on a new domain. Yes, I completely understand we will loose SEO value this way.
I currently have a cpanel redirect that makes this url:
https://www.kiss1047.net/
go to this
https://mytown-media.com/stations/kiss-104-7-kxnc-fm/
but that doesn’t get any of the internal pages to redirect. I would also like all internal pages (here is an example):
https://www.kiss1047.net/listen-live
to also go to:
https://mytown-media.com/stations/kiss-104-7-kxnc-fm/
I have tried a few things, but they always carry over the page url, ie above /listen-live/
https://mytown-media.com/stations/kiss-104-7-kxnc-fm/listen-live/
and that results in a 404.
is there some htaccess magic i can employ here?
2
Answers
In your
.htaccess
file .. Make a single entry that looks like:This will direct ALL TRAFFIC
(.*)
to your other website .. Regardless of file name or directory .. And will not append the file/directory to the end of the URL .. IElisten-live
This is a 301 Permanent redirect
[R=301,L]
.. Which means once followed by Google, will be indexed as such .. Also will cache in users browsers so that the browser remembers the 301 instead of bouncing between websites as well.This command in .htaccess redirects every page of your old domain to new domain’s one specific URL.
For your case:
In result:
https://www.kiss1047.net/listen-live
will be redirected to:
https://mytown-media.com/stations/kiss-104-7-kxnc-fm/