php.htaccessmod-rewriteurl-rewritingrewriting

htaccess url rewriting with multiple php vars in url


I need to create friendly urls for my website

need to change this url:
http://sitename.com/pn?title=1100متر+ویلایی+گلابدره&id=117

to this url, that contains utf-8 characters to
http://sitename.com/1100متر+ویلایی+گلابدره

I also need my variables like id, by using htaccess rewriting can i stil use them ?

is there a good doc that i can learn more about url rewriting ?
and is url rewriting good for website seo ?


THANKS


Solution

  • Try it like this, I am unsure about the character you are passing and also you need to pass id in url too for rewriting. Please let me know if it works.

    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/([\d]+)$ pn?title=$1&id=$2 [QSA,NC,L]