How To Redirect A Whole Site To A Single Web Page

I earlier mentioned how to collapse a WordPress blog, redirecting all the pages to a single destination page. At the time, I mentioned this only affected WordPress blogs – none of the other files on the site, such as .html files.

With yesterday’s transfer of Rocket Retriever, it was a bit different – regular pages, no blog – and I wanted all the pages, files, everything to redirect to a single page on this site. The key is the .htaccess file, which ‘rewrites’ a URL into another format – in this case, all links to the site are reworked into a single link to another site.

The secret? One line at the top of your old site’s root .htaccess file:

RedirectMatch 301 ^(.*)$ https://www.utopiamechanicus.com/article/rocket-retriever-free-key/ 

(Replacing the http://… with your destination URL, of course)

In this case, placing it at the root of RocketRetriever.com redirected everything to a single blog page on this site, where I could explain the (long-belated) closing. Note this redirect works better than others, since it also redirects subdirectories and files to this page – other variations will transfer the root, but then try to splice together the subdirectories which they pass on to the new URL (and which don’t exist at the destination).

When would you use this? It’s simple and direct – but it’s a big hammer for (sometimes) a tiny nail. For example, if you just want to move a blog, this is overkill. Likewise, if you want files to remain behind, it won’t allow the URLs to work. But if you’re closing a site down, it’s one line, quite effective, and gives you 301 redirect (called a ‘permanent’ redirect) which means search engines will understand they should now come to your new site, effectively wrapping up your old domain nicely.

Comments are closed.