how to redirect 404 page to date?

Status
Not open for further replies.

dr2015

Banned
Banned
97
2012
9
0
hello,

i want to redirect people to mydomain.com/dateoftoday if they come on my website page which doesnt exist

so if they if its today 10/29/2012 and they acces a 404 page on my website it must redirect them to mydomain.com/10/29/2012 so they can see all new posts of today

if they acces tomorrow (10/30/2012) it must redirect to mydomain.com/10/30/2012

can somebody please help? i have 7$ in my paypal, i can give it to u if u want
 
5 comments
What script are you using?

htaccess and a php file would seem the obvious way to go, but altering your script would maybe better.

eg.
PHP:
if (!$result) 
	{
	$today = date("m/d/Y");
	header("Location: /$today");
	}
 
Last edited:
im using a custom link short script a guy made me 2 years ago,

can you please give me htaccess code which can do it? i dont know what to do with the code u give

htaccess code?
 
Pm me the file that displays pages, or post some of it here.

There will be a query to grab the page data from the database, if that's empty then re-direct.
 
it doesnt has any data, its just a script index.php which is showing the page?

i want to completly delete the whole site, all files, and only put a htacces file, can u do it?

---------- Post added at 09:32 PM ---------- Previous post was at 05:35 PM ----------

i got this:


You can redirect with .htaccess using ErrorDocument 404 /404.php

And then inside 404.php file get the date and redirect again to mydomain.com/10/29/2012.

Example code:
<?php
$curDate = date("m/d/Y");
$url="http://www.mydomain.com/".$curDate;
header('Location:'.$url);
?>


but its redirecting to : mydomain.com/10/29/2012 and i want him to redirect to mydomain.com/10/29/2012.html, how to do it?

.html at the end how?
 
Status
Not open for further replies.
Back
Top