I have a problem with rewriting my url how can I rewrite this url below :
http://localhost/Car/index.php?page=allCars&numpage=2
this is the php and html code for testing
<a href="index.php?page=allCars&numpage=25>
ps : my page all cars is dynamique via index.php with parameter page
Options All -Indexes
RewriteEngine On
RewriteBase /Car/
RewriteRule ^([-a-zA-Z0-9]+)$ index.php?page=$1
Redirect from localhost/Car/index.php?page=allCars&numpage=2 this to localhost/Car/allCars/25
With your shown samples, please try following htaccess rules file. Please make sure to clear your browser cache before testing your URLs. These rules assume that your htaccess is present inside Car folder/directory.
Options All -Indexes -Multiviews
RewriteEngine On
RewriteBase /Car/
RewriteRule ^([-a-zA-Z0-9]+)/?$ index.php?page=$1 [QSA,L]
##External rewrite rule.
RewriteCond %{THE_REQUEST} \s/index\.php\?page=([^&]*)&numpage=(\d+)\s [NC]
RewriteRule ^ /Car/%1/%2? [R=301,L]
##Internal rewrite rule.
RewriteRule ^([^/]*)/([^/]*)/?$ Car/index.php?page=$1&numpage=$2 [L]