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 ^(.*)$ 

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

In this case, placing it at the root of 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.

Learning Web Design: A Beginner's Guide to HTML, CSS, JavaScript, and Web Graphi
End Date: Friday Jan-12-2018 16:07:42 PST
Buy It Now for only: $14.58
Buy It Now | Add to watch list
Web Development and Design Foundations with HTML5 by Terry Felke-Morris...
$12.44 (0 Bids)
End Date: Wednesday Dec-20-2017 10:39:45 PST
Bid now | Add to watch list
Exploring the Art & Technology of Web Design Book & CD Ruth Ann Anderson
End Date: Wednesday Jan-10-2018 17:40:30 PST
Buy It Now for only: $14.95
Buy It Now | Add to watch list

Leave a Reply

Your email address will not be published. Required fields are marked *