0

For example i have this url

mysite.com/page1-bla-bla.html

that have time specific content will be available for specific time period then after that the url should redirect to home page.

i think this will the solution for the problem i found today when i checked my google webmaster account today and found that i have many crawl errors due to 500 internal server error from pages that their content has expired as the content in this kind of pages is time limited available for specific time.

i have no idea how to do this may be htaccess is the solution or what?

looking for your ideas

Siolio
  • 1
  • 2
  • i want to redirect the link to home page if it give this error http://www.telelivesports.com/Free-Live-Streaming-Video-Online-Other-Fighting-Fighting-WWE-Main-Event-164357.html check the link – Siolio Aug 28 '13 at 14:40

2 Answers2

0

Usually, it's being done programmatically in your PHP script, this would let you have more control over the data and logic. But if you want to do something like this in your .htaccess, check out this article on time-related usage of mod_rewrite: http://www.askapache.com/htaccess/time_hour-rewritecond-time.html.

bredikhin
  • 8,875
  • 3
  • 40
  • 44
  • not what i mean i want to redirect the url after when i give error only – Siolio Aug 28 '13 at 14:37
  • Then you don't have choice but to catch an [exception](http://php.net/manual/en/language.exceptions.php) in your PHP script and create a [redirect](http://php.net/manual/en/function.header.php) from there. .htaccess would be of no help here. – bredikhin Aug 28 '13 at 15:04
0

Assuming I understood the question, you could add the following to the <head> of the HTML:

<meta http-equiv="refresh" content="600;URL=http:/mysite.com/" /> 

This will redirect the browser to the address http:/mysite.com/after 600 seconds (10 mins).

Edit:

$hours = intval(date('H'));
if ($hours < 7) {
    header('Location: http:/mysite.com/');
    die();
}
azz
  • 5,852
  • 3
  • 30
  • 58