I want to get this URL:
example.com/scooter-details/1/vespa-sprint
But the URL I get is:
example.com/scooter-details.php?scooter_id=1&scooter_brand=vespasprint&scooter_model=
scooter_model "sprint" is in the scooter_brand
query, which usually must be scooter_brand=vespa&scooter_model=sprint
. Hope you can help me solve this problem
htaccess
codeOptions +FollowSymLinks -MultiViews RewriteEngine On # SEO FRIENDLY URL # Redirect "/scooter-details.php?service_id=<num>" to "/scooter-details/<num>" RewriteCond %{ENV:REDIRECT_STATUS} ^$ RewriteCond %{QUERY_STRING} ^scooter_id=(\d+)&scooter_brand=([^/.]+)&scooter_model=([^/.]+)$ RewriteRule ^(scooter-details)\.php$ //%1/%2-%3? [QSD,L,R=301,N] # Rewrite "/scooter-details/<num>" back to "scooter-details.php?service_id=<num>" RewriteRule ^(scooter-details)/(\d+)/([^/]+)$ .php?scooter_id=&scooter_brand=&scooter_model= [L]
If you want to capture elements of the query string (i.e. already URL encoded) and use them to build a URL path. Otherwise, you'll end up with the double URL-encoded portion of the resulting URL path - that's what it looks like.
%20
is a double URL encoded space. ie. It appears that the query string you are capturing hasHowever, the rule you posted seems to have nothing to do with the example URL given?