FR | DE | EN268 membres inscrits | 4 connectés | 70 sujet(s) sur le forum dont 323 post(s) | Vendredi 4 juillet 2008 à 07h25
fleche Forum
Lecture du sujet -> Le .htaccess -> et l\'URL rexriting

Le .htaccess

et l'URL rexriting

AuteurMessage
#1 andman09/05/2008 à 17h44 - Post suivant
Groupe: newser

Date d'inscription: 02/02/2008 à 21h06
Bonjour,

je voudrais renommer mes URLs de .php en .htlm. Si j'ai bien suivi quelques tutos sur le Net, il faudrait faire :

dans le .htaccess :

RedirectPermanent /mondossier http://www.monsite.com/

RewriteEngine on
RewriteRule ([a-e0-9]*).php $1.html [R=301]

AddType application/x-httpd-php .html

DirectoryIndex index.php index.html


Voila. Vous avez même en prime une ligne, qui, il parait, transforme le dossier mondossier en le http://www.monsite.com/ . Voila, vous savez tous et je voudrais savoir si ce cocde marche.

Merci d'avance,
Andman
Page: [1]
#2 greg-dev09/05/2008 à 18h08Post précédent - Post suivant
Groupe: admin
admin

Date d'inscription: 17/06/2007 à 14h22
Bonjour,

Non, tu utilies mal le htaccess, c'est l'inverse dans ton RewriteRule quand tu mets l'extension.
ma signature... heu...<br /><br /><br />
#3 andman09/05/2008 à 18h28Post précédent - Post suivant
Groupe: newser

Date d'inscription: 02/02/2008 à 21h06
J'ai des pages en .php que je veux transformer en .html. Donc je fais :
RewriteRule $1.html ([a-e0-9]*).php [R=301] ?
#4 greg-dev09/05/2008 à 19h34Post précédent - Post suivant
Groupe: admin
admin

Date d'inscription: 17/06/2007 à 14h22
Oui, c'est ca sauf que ton expression est de nouveau inversé...
Tu dois en fait faire un truc du genre:

(expression régulière)html (VARIABLES EVENTUELLES).php(VARIABLES GET)

Dans ton cas probablement:
RewriteRule ([a-e0-9]*).html $1.php [R=301]
Edité par greg-dev le 09/05/2008 à 19h45
ma signature... heu...<br /><br /><br />
#5 andman09/05/2008 à 21h20Post précédent - Post suivant
Groupe: newser

Date d'inscription: 02/02/2008 à 21h06
Donc, si je veux transformer un foot.php (quel mauvais exemple ? ) ou autre, je dois faire :
RewriteRule ([a-e0-9]*).html $1.php [R=301]
#6 greg-dev09/05/2008 à 21h26Post précédent - Post suivant
Groupe: admin
admin

Date d'inscription: 17/06/2007 à 14h22
Si tu veux transformer foot.php en foot.html dans l'exemple, tu dois faire simplement:

Code APACHE:
RewriteEngine on
RewriteRule foot.html  foot.php [R=301]
ma signature... heu...<br /><br /><br />
#7 andman09/05/2008 à 21h34Post précédent
Groupe: newser

Date d'inscription: 02/02/2008 à 21h06
Ok ! Merci beaucoup !





A +
Andman

1 connecté sur ce sujet (1 anonyme et 0 membre)
Page: [1]

Warning: include(moteur_recherche.php) [function.include]: failed to open stream: No such file or directory in /var/www/forum777.php on line 559

Warning: include() [function.include]: Failed opening 'moteur_recherche.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/forum777.php on line 559

Fatal error: Call to undefined function recherche() in /var/www/forum777.php on line 567