Asesha George Asesha George -4 years ago 93
PHP Question

how to rewrite SEO-friendly url markep in htaccess

i am trying to convert my URL in to SEO Friendly url. i don't have much knowledge in htaccess rewrite rules bellow is my URL.

the URL should be

i tried bellow one

RewriteEngine On
RewriteCond $1 ^search
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ search.php?q=$1 [L,QSA]

i got the result as


i am using jquery to redirect

window.location.href = 'search?loc=' + location[0] + '&q='+ search_term;

Answer Source
RewriteRule ^([^/]*)/([^/]*)$ /search.php?loc=$1&q=$2 [L]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download