How Do You Redirect An Entire Website To A Single Page?

5 replies
I need to take one of my sites down for a couple of hours and I don't want any pages to be accessed during that time.

How can I redirect the entire site (hundreds of pages) to a temporary URL (on the same domain)?

Can I do it with htaccess? Is there an easier way?

Thanks!
Allen
#entire #page #redirect #single #website
  • Profile picture of the author jjpmarketing
    Allen,

    This is your best option. Change the redirect on the domain or change the DNS to direct to a specific page. The DNS option could take a while to take effect though...

    OR...

    Create an index.html or default.html (this depends on your host) with a meta refresh redirect to a "down for maintenance" kind of page. This method is quick and effective.

    Wikipedia instructions: Meta refresh - Wikipedia, the free encyclopedia

    That is the best recommendation I can come up with, without knowing what type of site this and how it is setup.

    Or better yet, just password protect the directory the domain is setup on.

    EX: domainsite.com is stored in public_html/domainsite folder.

    Password protect the "domainsite" folder. This can be done either using cPanel's tool or via htaccess.

    PM me if you need further assistance.

    Dennis
    {{ DiscussionBoard.errors[2049379].message }}
  • Profile picture of the author HowWhoWhen
    If you're using WP you can use a plugin such as Maintenance Mode. If not, htaccess should do the trick. Something like this:

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule ^(.*)\.html$ http://www.yourdomain.com/temp.htm [R=301,L]
    {{ DiscussionBoard.errors[2049429].message }}
  • Profile picture of the author theIMgeek
    @HowWhoWhen has the right idea. However, the code he posted would only redirect urls that end in .html (so something like example.com/folder would be skipped)

    This will match any page or directory EXCEPT images, CSS, and javascript (each of which you may want to use on your maintenance page)

    It also specifically says not to redirect if the page ends in temp.html (the name of your maintenance notice) or else it would create an infinite redirect loop.

    Also... key point! It sends code 503 rather than 301. 503 means "temporarily unavailable" while 301 is a permanent redirect that can affect search listings.

    Code:
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule ^(.*)[^.[gif|jpg|png|jpeg|css|js|temp.html]]?$ http://www.example.com/temp.html [R=503,L]
    -Ryan
    Signature
    FREE WSO: Protect and Automatically Deliver Your Digital Products

    Ask the Internet Marketing Geek
    <-- Happy to help with technical challenges
    MiniSiteMaker.org <-- Free software to make your mini-sites fast and easy
    {{ DiscussionBoard.errors[2049502].message }}
    • Profile picture of the author Jill Carpenter
      You can do a temporary redirect - or as someone else mentioned change the DNS or just futz with the index page.

      As for access to any of the pages, well, they may still show up in the search and the cache versions are tough to get rid of.
      Signature

      "May I have ten thousand marbles, please?"

      {{ DiscussionBoard.errors[2049550].message }}
  • Profile picture of the author Allen Graves
    Thanks y'all - unfortunately, htaccess makes me pee my pants!

    I do have php pages (forum/blog) as well as html pages (regular html site - not WP).

    Allen
    Signature
    Every day I check the obituaries. If I don't see my name there, then I know it's going to be a good day!
    {{ DiscussionBoard.errors[2049557].message }}

Trending Topics