apache - Creating SEO Friendly URLs with .htaccess and php -


i'm trying generate seo friendly urls using php using rewrite in our .htaccess file, can't work (i've researched many of related topics on stackexhange , elsewhere, no avail).

i'm attempting make content of url: http://199.119.123.135/surety-bonds/city.php?state=california&city=sacramento

...also display on cleaner url version here: http://199.119.123.135/surety-bonds/california/sacramento/

i'm using following code in .htaccess file:

rewriteengine on rewriterule ^surety-bonds/([a-za-z]+)$ city.php?state=$1&city=$2 [l,nc] 

any idea why cleaner url displays 404 error?

thanks!

try:

rewriteengine on  rewritecond %{the_request} \ /+surety-bonds/city\.php\?state=([^&]+)&city=([^&\ ]+) rewriterule ^ /surety-bonds/%1/%2/? [l,r]  rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^^surety-bonds/([^/]+)/([^/]+)/?$ /surety-bonds/city.php?state=$1&city=$2 [l,qsa] 

in htaccess file in document root.


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -