PDA

View Full Version : Taking Website Offline


Crumpy1
01-07-2013, 10:43 AM
Hi,

I need to take one of my websites down for a period of time to do a major store revamp to improve user experience.

How do i do this so not matter what url they use it displays one of my webpages which simply says we are down until 17:00GMT

Thanks

Ricky55
01-07-2013, 05:52 PM
The easiest way is to just re-name the index file and replace it with a store being updated index file but that won't prevent pages from deeper within the site from displaying.

The best way to do this is via htaccess if you are using an Apache server (you almost certainly will be unless you are using ASP and then you may be using a Windows server)

If you're not familiar with an htaccess file its an hidden type of file that controls how your server behaves. You can do some really handy things with htaccess and one of them is this.

If you use the following code it will close the site down to everyone apart from any IP address that you specify.


Options +FollowSymlinks
RewriteEngine on

RewriteCond %{REQUEST_URI} !\/storeClosed\.html
RewriteCond %{REMOTE_ADDR} !191\.143\.35\.153
RewriteRule ^(.*)$ /storeClosed.html [R=302,L]


Enter your IP address to replace the 191 143 if you need to gain access which I assume you will. This will allow you access but no one else.

You can get your IP address using this website

http://www.whatsmyip.org

This example file points all traffic to a file called storeClosed.html If you need to use images then you'll need to add these too.

Save the file with a full stop before the file name .htaccess

Once you do this the file will become hidden (does in Mac OS) so in your FTP program you may need to show hidden files, I think Dreamweaver shows hidden files by default but not 100% on that one.

Hope that helps.

Cheers

Crumpy1
01-08-2013, 10:24 AM
I am using a linux server to host this website using hostmysite as my hosting provider.

I have used both filezilla (with forcing hidden folders enabled) and dreamweaver but cannot find any htaccess file. Where is this usually located?

Thanks

Ricky55
01-08-2013, 10:54 AM
A linux server will be running Apache on it so thats cool.

If you can't find a file, create one, just create a new file of any type in Dreamweaver or any code editor and enter the code I provided and save the file as .htaccess then upload to your server.

.htaccess can be located any where but this once needs to be stored in the root of your website where your index.html is.

Cheers

Crumpy1
01-08-2013, 04:50 PM
Thank you for the info, we are planning to take the website down this monday so i will repost if we encounter issues.

Thanks

Ricky55
01-08-2013, 07:48 PM
No worries mate. One other thing I do is add my clients IP addresse(s) so they can check out the changes before you reveal it to the public.

You can do some great things with htaccess, this is a great book if you want to learn more.

http://htaccessbook.com/

I'd also check out the HTML5 boiler plate as their htaccess file is great to use on your own sites.

http://html5boilerplate.com/

Cheers

Crumpy1
06-24-2013, 10:43 AM
I am looking to take down the website now, the client has left it a while whilst she did promotional stuff etc.

I am unable to edit the .htaccess file using filezilla as it is restricted and it will not let me change authorisation options. Is there an example of an htaccess file i can add this code to and overwrite the original one?

edbr
06-25-2013, 02:49 AM
i would just rename the index and put a new indax file for now , either with information r a php redirect this same as a 302 redirect
<?php
header(”Location: http://www.your-web-site.com/temp-location/index.html”);
exit();
?>

Crumpy1
06-25-2013, 08:24 AM
i would just rename the index and put a new indax file for now , either with information r a php redirect this same as a 302 redirect
<?php
header(”Location: http://www.your-web-site.com/temp-location/index.html”);
exit();
?>

Thanks Edbr, I was going to do this if i was unable to resolve the .htaccess issue but as the website has links on other websites and to specific pages throughout the web this would no stop people getting to pages further into the site, this option would mean removing the entire website from the server then reuploading it again.

This does look like the only option as my host have locked the file on purpose to stop people amending them.

Cheers!!

edbr
06-25-2013, 08:42 AM
move it to a sub
directory and protect/ re direct that

Crumpy1
07-16-2013, 08:21 AM
move it to a sub
directory and protect/ re direct that

Hi Edbr,

Can you explain this a little bit more?

So i create another folder in root and move all files but those needed for the new index.php to the new sub folder?

How do i protect & redirect?

Thanks