I’m developing server checking & monitoring webpage. I would left the page open all the time on my browser. So it will be good to that page auto refresh every certain amount of time so I don’t have to keep hitting F5 manually to refresh.
There are a few option that I have, I can do it either by using PHP Code, HTML Meta tag or JavaScript.
For example I want to refresh the webpage every 10 seconds. The are the code.
PHP Code
<?php
$url=$_SERVER['REQUEST_URI'];
header("Refresh: 10; URL=$url");
?>
HTML Meta Tag
<meta http-equiv="refresh" content="10">
JavaScript
<body onload=”javascript:setTimeout(“location.reload(true);”,10000);”>
In the previous post, I post a guide on how to create SEO friendly URL in CakePHP pagination.
However, if you already use default CakePHP pagination prior to that, you want to redirect the old pagination URL to the new SEO friendly URL.
I’m using .htaccess file to accomplish this.
Let’s take an example, by default we will have pagination URL like this
http://www.website.com/post
http://www.website.com/post/page:2
http://www.website.com/post/page:3
...
we would like to redirect to
http://www.website.com/post
http://www.website.com/post/page/2
http://www.website.com/post/page/3
...
To redirect, we have to edit .htaccess file located at /app/webroot/.htaccess. Next, add the following code.
RewriteEngine On
RewriteBase /
RewriteRule ^(.+)/page:([0-9]+)/$ /$1/page/$2/ [R=301,L]