C'est tout à fait le principe. On cache le ? pour passer des paramètres
Par exemple
Code : Tout sélectionner
monsite.com/f2-laville.FR23
est compris par le serveur comme
Code : Tout sélectionner
monsite.com/ville.php?idville=f2-laville&code=FR23
Code : Tout sélectionner
monsite.com/f2-laville.FR23
Code : Tout sélectionner
monsite.com/ville.php?idville=f2-laville&code=FR23
Mon code est :affichagebienlocation/index.php
Code : Tout sélectionner
if(isset($_POST['urlbien'] )) {
$reference = substr($_POST['urlbien'], strrpos($_POST['urlbien'], '.' )+1)."\n";
$reference = rtrim($reference);
}
Code : Tout sélectionner
echo"<form class='detailbien' id='formulaire' action='affichagebienlocation/?".$renvoi."' method='post'>";
echo"<input type='hidden' name='urlbien' id='urlbien' value='".$renvoi."'>";
$_SESSION['url'] = $renvoi;
echo"<input id='detail' type='submit' class='envoiformulaire' value='Détail Bien' name='detail'/>";
echo "</form>";
la variable $renvoi est la concaténation de Titre+.+REFERENCEmonsite.com/ville.php?idville=f2-laville&code=FR23
Code : Tout sélectionner
http://monsite/affichagebienlocation/?f3-maville.DENF1B0202
à la racine du site je mets dans le formulaire :index.php
Code : Tout sélectionner
echo"<form class='detailbien' id='formulaire' action='affichagebienlocation/' method='post'>";
Code : Tout sélectionner
http://monsite/affichagebienlocation/
Code : Tout sélectionner
bien-location
Code : Tout sélectionner
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)$ /affichagebienlocation/?$1 [QSA,L]
Code : Tout sélectionner
monsite/bien-location/f2-laville.FR23
dans lequel je mets le fichier qui est appelé qui s'appelle index.phpbien-location
Code : Tout sélectionner
RewriteRule ^(.*)$ /[b]affichagebienlocation[/b]/?$1 [QSA,L]
est-ce volontaire?bien-location
MerciInternal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at wampserver@wampserver.invalid to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Apache/2.4.62 (Win64) PHP/8.3.10 mod_fcgid/2.3.10-dev Server at XXXXXXXXXXXX Port 80
Code : Tout sélectionner
RewriteRule ^(.*)$ /[b]affichagebienlocation[/b]/?$1 [QSA,L]
Code : Tout sélectionner
echo"<form class='detailbien' id='formulaire' action='bien-location/[b]?[/b]".$renvoi."' method='post'>";
Code : Tout sélectionner
Not Found
The requested URL was not found on this server.
Code : Tout sélectionner
http://monsite/bien-location/[b]f3-belfort.DENF1B0202[/b]
Code : Tout sélectionner
echo"<form class='detailbien' id='formulaire' action='affichagebienlocation/' method='post'>";
Code : Tout sélectionner
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)$ /affichagebienlocation/?$1 [QSA,L]
Code : Tout sélectionner
echo"<form class='detailbien' id='formulaire' action='bien-location/".$renvoi."' method='post'>";
Code : Tout sélectionner
RewriteRule ^(.*)$ /[b]affichagebienlocation[/b]/?$1 [QSA,L]