8791 sujets

Développement web côté serveur, CMS

Bonjour à tous,
en pleine réalisation de site web, je me retrouve bloqué face à mon htaccess.

Je souhaiterai faire de la réécriture d'URL
Ma 1ère partie fonctionne mais je n'arrive pas à faire fonctionner le reste.


Options +FollowSymlinks
RewriteEngine on
RewriteRule ([^.]+)\$ /$1.php [L] 

ErrorDocument 404 /error


voila mon htaccess

que fait il ?
Il transforme une url du type : www.monsite.fr/profil.php ====> www.monsite.fr/profil

Maintenant sur mon site j'utilise un css switcher qui me rajoute donc des paramètres dans l'url
du type www.monsite.fr/profil.php?style=bleu

J'aimerais avoir au final www.monsite.fr/profil/bleu
et si il n'y a pas de style j'aimerais juste avoir www.monsite.fr/profil

Quelq'un à une idée de comment faire ? Smiley rolleyes


Cordialement


CraZy
Ici j'ai trouve une chose qui peut t'aider...
a écrit :
If You are working with the Apache module mod_rewrite and want to set some environment vars, the Apache manual says this vars could be accessed in CGI using $ENV{VAR}. In PHP You might want to write $_ENV['VAR'] to get the value of VAR, but You have to access if via $_SERVER, and in some different ways:

1. Example: .htaccess and example.php

RewriteEngine on
RewriteRule ^?var1=([^;]*);var2=([^;]*)$ \
- [E=VAR1:$1,E=VAR2:$2]

<?php echo($_SERVER['VAR1']."\r\n"
.$_SERVER['VAR2']); ?>

2. Example: .htaccess and index.php

RewriteEngine on
RewriteRule ^index\.php$ - [L]
RewriteRule ?var1=([^;]*);var2=([^;]*)$ \
index.php [E=VAR1:$1,E=VAR2:$2]

<?php echo($_SERVER['REDIRECT_VAR1']."\r\n"
.$_SERVER['REDIRECT_VAR2']); ?>

Note: If any RewriteRule matches, an internal redirect than restarts (after the last defined rule, or immediately after the matched rule having a L-flag) checking the entire rule set again. For an internal redirect every defined VAR gets an 'REDIRECT_' prefix, i.e. VAR1 will be REDIRECT_VAR1, VAR2 will be REDIRECT_VAR2.

Bonne chance! Smiley cligne