PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Thu May 28, 2020 9:55 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue Aug 12, 2014 3:26 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4434
Location: United Kingdom
Hi.

The people who manage the sites I run sometimes change categories names, sometimes even update product IDs, and because of that, you do get URLs cached by Google (and others) that become redundant.

All these sites run from their own index.php template. So how do you identify, perhaps in index.php if the productID queried exists, and if not, take them to perhaps a 404 Error page that Google sees as a 404 or a 301?

We can manually change and do 301s in htaccess via a CSV export and just point them all to a page. But be better if it did this dynamically.

Web sites must do this kind of thing all the time, specially with sites that customers "run" (ebay, amazon, Facebook etc).

Index looks for the ID, it doesn't exist, so goes to a error.inc file. But Google doesn't see that file as a 404 or 301 direction. So how do you do that?
Can you query a database via htaccess and if the ID doesn't exist, do a 301??

_________________
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.


Top
 Profile  
 
PostPosted: Tue Aug 12, 2014 6:23 am 
Offline
Forum Newbie

Joined: Tue Aug 12, 2014 6:13 am
Posts: 19
Location: Chennai, India
For 301, how do you want the index php script to redirect ? Based on what parameters?

_________________
Chris, Php Developer and Programmer,
https://www.phpfreelanceprogrammer.com/


Last edited by phpdeveloper1 on Tue Aug 12, 2014 6:58 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Tue Aug 12, 2014 6:48 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4434
Location: United Kingdom
For 301, I want to query the database based on the the URL's $id, and if the $id is not in the system, to do a 301 to /error.

_________________
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.


Top
 Profile  
 
PostPosted: Tue Aug 12, 2014 7:00 am 
Offline
Forum Newbie

Joined: Tue Aug 12, 2014 6:13 am
Posts: 19
Location: Chennai, India

_________________
Chris, Php Developer and Programmer,
https://www.phpfreelanceprogrammer.com/


Top
 Profile  
 
PostPosted: Tue Aug 12, 2014 7:29 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4434
Location: United Kingdom
But how will the 301 work dynamically?
I know how to do a 301. But I need it to query the ID of the page it is crawling, and then do a 301.

_________________
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: Google [Bot] and 21 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group