Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Redirect, remotely swap pages

Featured Replies

Hi Guys,

I have two html pages, they are pretty much identical except one has a message that says 'all systems ok' with a green icon and the other says 'systems down' with a red icon. The one with the red icon does nothing and the one with the green icon automatically redirects within a few seconds.

 

Is there any way I can remotely swap these pages to be active without having to manually overwrite them via ftp?

 

Or is there a better way of doing this altogether?

 

Thanks for your help

PHP. You could create a page that only you have access you, that allows you to select what page you want to appear as the home page.

 

Just an idea; I wouldn't have any idea how to build that sort of thing though.

  • Author

Thanks guys, the twitter idea would be ideal as I could even change it via text message that way.

 

Any ideas where I can get help with this? PHP isnt something Im all that familiar with?

 

Thanks again

Not knowing Twitter feeds I'm guessing it will be a nightmare to find the post that you will need to control things.

 

PHP - http://www.tizag.com/phpT/index.php

 

If with your remote access you can get to a webpage then create one that you update a file with yes/no. Then read that on the actual site and direct the output.

 

 

The lesser control option would be with .htaccess like this http://edwardawebb.com/web-development/redirecting-users-sitedown-message but you've still got to get to that file and change it.

Okay, keeping it really simple.

 

1. Have two php pages that you just run in a browser to say whether the site is up or down. Write the data to a .txt file1

 

2. Read the text file to see its value and work with that on the actual page

Site down. Easy to work out how to create an Up version ;)

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
</head>

<body>

<?php 

$fp = fopen("sitestatus.txt", "w") or die("Couldn't create new file"); 
$numBytes = fwrite($fp, "down"); 
fclose($fp); 

echo "Site status is now DOWN!"; 

?> 


</body>

</html>

 

 

Now read the file:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
</head>

<body>

<?php 

$myFile = "sitestatus.txt";
$fh = fopen($myFile, 'r');
$status = fread($fh, 4);
fclose($fh);
echo $status;



?> 


</body>

</html>

 

You will need to create the sitestatus.txt and give it read/write access

 

 

Next is to do some conditional PHP. Do you want to play with that?

 

http://www.tizag.com/phpT/ifelse.php

http://www.tizag.com/phpT/include.php

 

:)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.