php - htaccess get parameters for seo url -
// sorry grammar mistakes , other thing that's wrong, english isn't mother tongue(don't know if spelled good).
i have made seo friendly urls htaccess. problem is, information out url(using get) , seo friendly urls can't that.
my previous url this:
http://rasolutions.eu/blogitem?id=2
so in php $_get['id'] , 2. i've got seo friendly urls it's this:
http://rasolutions.eu/blogitem/2/
and php script can't see id from, return me homepage.
i have googled need use (.*) in htaccess don't know or how. htaccess code atm:
options +multiviews rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^([^\.]+)$ $1.php [nc,l] # www not www. rewritecond %{http_host} ^www\.rasolutions\.eu$ rewriterule ^/?$ "http\:\/\/rasolutions\.eu\/" [r=301,l] rewriterule ^blog/(.*)([0-9]+)/$ blog.php?page=$1 [nc,l] rewriterule ^blogitem/(.*)([0-9]+)/$ blogitem.php?id=$1 [nc,l]
the last 2 rules should correct without (.*)
according example syntax posted. , have take care of trailing slash (/
) in flexible manner:
options +multiviews rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^([^\.]+)$ $1.php [nc,l] # www not www. rewritecond %{http_host} ^www\.rasolutions\.eu$ rewriterule ^(.*)$ http://rasolutions.eu$1 [r=301,l] rewriterule ^blog/([0-9]*)/?$ blog.php?page=$1 [nc,l] rewriterule ^blogitem/([0-9]*)/?$ blogitem.php?id=$1 [nc,l]
in general very idea use rewritelogging if have access it. helps understand going on inside rewriting engine @ each single sub step instead of having guess happens.
Comments
Post a Comment