PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > php script does not always execute or too slowly 301 redirect
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
php script does not always execute or too slowly 301 redirect

Réponse
 
LinkBack Outils de la discussion
Vieux 23/01/2008, 16h41   #1
mark Bannister
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut php script does not always execute or too slowly 301 redirect

Hello,
PHP vesion 4.4.1
On our corporate web site we use a common script that is called via an
include at the start of every page.
We just made a major site change and have a long list of 301 redirects.
I decided to handle the 301's in the common script instead of htaccess.

Now in the logs we are getting a lot of 404 not found errors on pages
that should be redirecting. Most of these are from robots, but not all.
I was wondering if this was just a timeout issue. I am logging all
errors and do not see any occurring.

The sequence of events is:
request for a not found page handled by htaccess and passed to a
notfound.php page.
The first thing notfound.php does is include the common script. This
script checks an array for a redirected uri. If it matches it sends a
301 header with the new page and exits.

What is happening that on some occasions the client is getting a 404
and we are not showing any errors occurring in PHP?




--
Mark B
  Réponse avec citation
Vieux 24/01/2008, 13h56   #2
mark Bannister
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: php script does not always execute or too slowly 301 redirect

mark Bannister wrote:
> Hello,
> PHP vesion 4.4.1
> On our corporate web site we use a common script that is called via an
> include at the start of every page.
> We just made a major site change and have a long list of 301 redirects.
> I decided to handle the 301's in the common script instead of htaccess.
>
> Now in the logs we are getting a lot of 404 not found errors on pages
> that should be redirecting. Most of these are from robots, but not all.
> I was wondering if this was just a timeout issue. I am logging all
> errors and do not see any occurring.
>
> The sequence of events is:
> request for a not found page handled by htaccess and passed to a
> notfound.php page.
> The first thing notfound.php does is include the common script. This
> script checks an array for a redirected uri. If it matches it sends a
> 301 header with the new page and exits.
>
> What is happening that on some occasions the client is getting a 404 and
> we are not showing any errors occurring in PHP?
>
>
>
>


I have changed the way the 301 header is sent
Was:
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.injection-moldings.com'.$page);

IS:
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.injection-moldings.com'.$page,FALSE,301);

I will play with it and remove the first header and also change the
replace header location, but this either worked OR the robots gave up....


--
Mark B
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 11h19.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,31517 seconds with 10 queries