Hi Everyone,

My htaccess isn't account for spaces with certain keywords. I'm not sure why because I thought my syntax was correct but it turns out it's wrong.

A URL like this one on my website is working. It's working because there are no spaces in between keywords.

A URL like this on my website is working but I don't want the %20 in between any keywords.

My goal is to take the second above URL (the one with a space) and make it look like this below URL

or take a URL like this

and turn it into this

How would I do that?

My .htaccess code is below.

RewriteEngine On
RewriteRule ^([_a-zA-Z_]+)$ state.php?state=$1 [L]
RewriteRule ^([_a-zA-Z_]+)/([_a-zA-Z_]+)$ city.php?state=$1&city=$2 [L]
# RewriteRule ^([_a-zA-Z_]+)/([_a-zA-Z_]+)/([_a-zA-Z_]+)/([_a-zA-Z_]+)/([_a-zA-Z_]+)$ make-model.php?state=$1&city=$2&year=$3&make=$4&model=$5 [L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)$ /make-model.php?state=$1&city=$2&year=$3&make=$4&model=$5 [L]
Thanks everyone!