.htaccess - mod_rewrite removes the ?page= fine, get &id= not working -
i got .htaccess working correctly going from:
webshop/index.php?page=home webshop/home
if put id in url still needs webshop/product&id=1. want create webshop/product/1.
searched lot of options on internet not working. code below .htaccess file.
options +followsymlinks -multiviews rewriteengine on # removes index.php url rewritecond %{the_request} /index\.php [nc] rewriterule ^(.*?)index\.php$ /$1 [l,r=302,nc,ne] # rewrites /home /index.php?page=home rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^webshop/([^/]*)$ /webshop/?page=$1 [qsa] hope guys can me out.
you can use:
options +followsymlinks -multiviews rewriteengine on # removes index.php url rewritecond %{the_request} /index\.php [nc] rewriterule ^(.*?)index\.php$ /$1 [l,r=302,nc,ne] # skip files , directories rewrite rules below rewritecond %{request_filename} -d [or] rewritecond %{request_filename} -f rewriterule ^ - [l] # rewrites /webshop/product/1 /webshop/index.php?page=product&id=1 rewriterule ^webshop/([^/]+)/(\d+)/?$ /webshop/?page=$1&id=$2 [nc,qsa,l] # rewrites /webshop/home /webshop/index.php?page=home rewriterule ^webshop/([^/]*)$ /webshop/?page=$1 [nc,qsa,l] you can change (\d+) ([^/]+) if id not number
Comments
Post a Comment