Jump to content

[Résolu] - Mauvais lien sur page suivante


Recommended Posts

Bonjour,

 

Les liens sont formés grâce à la variable d'environnement PHP $_SERVER['PHP_SELF'].

Cette variable affiche le nom du fichier en relatif, et non absolu...

 

Si celle-ci vous retourne une variable absolu, c'est qu'il y a un problème de configuration de votre serveur, les variables d'environnement ne retournant pas les valeurs habituelles.

 

Quel est votre hébergeur ? (au hasard OVH ;)).

Link to comment
Share on other sites

Oui, les variables d'environnement semblent affectées sur OVH, notamment avec l'url_rewriting.

 

Si tu veux te pencher dessus et voir quelles sont les particularité de cet hébergeur, voir trouver une astuce pour palier le problème, ça pourrait aider la communauté :)

 

Merci ;)

Link to comment
Share on other sites

  • 3 weeks later...

Bonjour, j'ai eu le même problème chez OVH

Voilà comment j'ai résolu le problème :

 

Fichier classes/Link.php ligne 27 :

 

		$this->url = htmlentities($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8');

devient

		//$this->url = htmlentities($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8');
	$url = explode("?", $_SERVER['REQUEST_URI']); // bidouille pour retrouver $_SERVER['PHP_SELF']
	$this->url = htmlentities($url[0], ENT_QUOTES, 'UTF-8');

 

et le fichier .htaccess

# URL rewriting module activation
RewriteEngine on

# URL rewriting rules
RewriteRule ^([0-9]+)-([a-zA-Z0-9-]*).html(.*)$ product.php?id_product=$1$3 [L,E]
RewriteRule ^([0-9]+)-([a-zA-Z0-9-]*)(.*)$ category.php?id_category=$1$3 [L,E]
RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ supplier.php?id_supplier=$1$3 [L,E]
RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ manufacturer.php?id_manufacturer=$1$3 [L,E]

# Catch 404 errors
ErrorDocument 404 /404.php

 

devient

 

# URL rewriting module activation
RewriteEngine on

# URL rewriting rules
RewriteRule ^([0-9]+)-([a-zA-Z0-9-]*).html(.*)$ product.php?id_product=$1$3 [QSA,L]
RewriteRule ^([0-9]+)-([a-zA-Z0-9-]*)(.*)$ category.php?id_category=$1$3 [QSA,L]
RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ supplier.php?id_supplier=$1$3 [QSA,L]
RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ manufacturer.php?id_manufacturer=$1$3 [QSA,L]

# Catch 404 errors
ErrorDocument 404 /404.php

 

ça fonctionne semble-t-il. Par contre on se retrouve avec des doublons dans les urls : http://boutique.com/5-les-elephants?id_category=5&p=2 la catégorie est spécifiée 2 fois mais ça ne pose pas de problème.

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...