e1seix Posted June 5, 2008 Share Posted June 5, 2008 Hi all, I have another good one for you all. lol. I have a script on my website that I run once a day to update my listings from various datafeeds that change on a day to day basis. During this time my website, if only for 5 mins, looks a bit of a mess with duplicate products, error messages etc. I was wondering if there's a way you could implement something into the below "Update" script that at the start will redirect customers to another page explaining that the website is updating and to check back soon, and then reinstate the original homepage at the end of the script <?php // MERCHANTS echo file_get_contents("http://www.malegroomingfordummies.co.uk/controlPanel/setInStock.php"); // SET echo file_get_contents("http://www.malegroomingfordummies.co.uk/controlPanel/setPrice.php"); ?> Any ideas people? Many thanks, Quote Link to comment https://forums.phpfreaks.com/topic/108863-changin-my-index-homepage-while-script-running/ Share on other sites More sharing options...
hansford Posted June 5, 2008 Share Posted June 5, 2008 yeah but the other page would have to redirect back to the first page. And the user would have to instigate a return back to this page because-I assume you want them to read that the site is being updated. On the second page just let them read your message and then have a link below it saying return to homepage. on page1 you could do: ------------------------------- $page = "/nextpage.php"; echo "<html><body onload=\"window.location='$page'\">"; echo file_get_contents ("http://www.malegroomingfordummies.co.uk/controlPanel/setInStock.php"); echo file_get_contents("http://www.malegroomingfordummies.co.uk/controlPanel/setPrice.php"); echo </body></html> Quote Link to comment https://forums.phpfreaks.com/topic/108863-changin-my-index-homepage-while-script-running/#findComment-558581 Share on other sites More sharing options...
sasa Posted June 5, 2008 Share Posted June 5, 2008 in root of your serwer create page update.html and in .htaccess file put RewriteEngine on RewriteRule !(update.html$) /update.html this all request redirect to update.html Quote Link to comment https://forums.phpfreaks.com/topic/108863-changin-my-index-homepage-while-script-running/#findComment-558604 Share on other sites More sharing options...
discomatt Posted June 5, 2008 Share Posted June 5, 2008 Have your cron script copy the original page to a folder outside webroot, and replace it with an 'updating' page. Once the cron is finished, move the original page back to its rightful place Quote Link to comment https://forums.phpfreaks.com/topic/108863-changin-my-index-homepage-while-script-running/#findComment-558607 Share on other sites More sharing options...
e1seix Posted June 5, 2008 Author Share Posted June 5, 2008 in root of your serwer create page update.html and in .htaccess file put RewriteEngine on RewriteRule !(update.html$) /update.html this all request redirect to update.html Cron Job is way too messy as can't stipulate exactly how long the update script will run for etc. I'm intrigued by this Rewrite business. Let's just pretend the page I want displayed when my "update.php" script is running is called "alternativePage.php". Am I right in thinking I would put in RewriteEngine on RewriteRule !(update.php$) /alternativePage.php Is this right? Quote Link to comment https://forums.phpfreaks.com/topic/108863-changin-my-index-homepage-while-script-running/#findComment-558757 Share on other sites More sharing options...
DarkWater Posted June 5, 2008 Share Posted June 5, 2008 No. His rewrite rule was saying: Send ALL requests that aren't for update.html to update.html. Quote Link to comment https://forums.phpfreaks.com/topic/108863-changin-my-index-homepage-while-script-running/#findComment-558766 Share on other sites More sharing options...
e1seix Posted June 5, 2008 Author Share Posted June 5, 2008 One more question and then I will leave you all alone as I will be heading to bed... as .htaccess is new to me, where am I uploading this to. My main directory with index.php, the folder alongside the update.php. I am aware of all the trickery involved in uploading and changing the file itself. How can I change this code to do so that while update.php is running, all other requests divert to alternativePage.php. Many many thanks guys, Quote Link to comment https://forums.phpfreaks.com/topic/108863-changin-my-index-homepage-while-script-running/#findComment-558772 Share on other sites More sharing options...
DarkWater Posted June 5, 2008 Share Posted June 5, 2008 You can't. You can make update.php actually edit the file and save a new copy, and then clean it up when you finish. Quote Link to comment https://forums.phpfreaks.com/topic/108863-changin-my-index-homepage-while-script-running/#findComment-558795 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.