php - url rewriting and pass the form's values -



php - url rewriting and pass the form's values -

i'm having e commerce website in php. , moving fancy urls, url rewriting.

for i've variable length of parameters optional variables too.

for example,

http://example.com/product.php?page=e&id=23&color=blue&size=xxl&width=200&height=100

here, parameters optional means, variables may or may not participage in url except id.

here, page=e fixed , not dynamic. ( reason behind i've other rewritten rules ^categories, ^toys etc..

and re-written url should 1 of these,

http://example.com/e/23/color-blue/size-xxl/ http://example.com/e/26/color-black/width-500/height-900/ http://example.com/e/56/type-shirt/color-white/height-345/size-xl/

i've tried below no luck,

rewriterule ^e/([^/.]+)/?$ product.php?page=e&url=$1 [l,nc,qsa]

i'm getting $_get values this,

http://example.com/product.php?page=e&id=23&color=blue&size=xxl&width=200&height=100

but i'm trying accomplish this,

http://example.com/e/23/color-blue/size-xxl/width-200/height-100

how can pass queries slashes , not &'s.

that main thought behind above lastly url process whole fancy url simple 1 in php,

and utilize variables in page script. there improve solution ??

you can utilize code in document_root/.htaccess file:

rewriteengine on rewritebase / rewriterule ^(e)/([0-9]+)/([^-]+)-([^/]*)(/.*)?$ product.php$5?page=$1&id=$2&$3=$4 [l,qsa] rewriterule ^(product\.php)/([^-]+)-([^/]*)(/.*)?$ $1$4?$2=$3 [l,qsa]

php .htaccess url url-rewriting seo

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -