mod_rewrite

L'utilisation du mod_rewrite peut être très utile pour la réécriture d'un URL. Par exemple, au lieu d'avoir un site avec http://www.unsite.com/billets/archives.php?an=2008&mo=04 on pourrait avoir une URL tel que http://www.unsite.com/2008-04. La meilleure façon de le faire est à travers le fichier .htaccess.

Exemple:

RewriteEngine On
RewriteRule ^([0-9]+)-([0-9]+)$ /billets/archives.php?an=$1&mo=$2

On peut aussi y mettre des conditions :

RewriteCond %{HTTP_HOST} ^espacealouer.org$
RewriteRule ^(.*)$ http://www.espacealouer.org/$1 [R=301,L]
Toute requête faite avec espacealouer.org sera redirigé vers http://www.espacealouer.org/.


http://www.webmaster-hub.com/publication/Mod-rewrite-ou-la-reecriture-des.html

Erreurs

500 - Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@espacealouer.org and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Le message d'erreur n'est pas très précis. Plusieurs fois le problème a été le client FTP qui a mis les permissions fichier à 777 sur un fichier PHP. Le groupe ne doit normalement pas avoir droit d'écriture. Donc un chmod 755 est préférable.

 
web/apache.txt · Dernière modification: 2011/06/03 12:08 (modification externe)
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki