php - htaccess cant get rewrite seo friendly url -


hi have use many different htaccess codes, cant rewrite work. want url https://domain.com/category.php?cat=firm url https://domain.com/category/firm

this latest attempt

options +followsymlinks rewriteengine on rewriterule ^([^/]*)\.html$ /category.php?cat=$1 [l] errordocument 404 https://seoboost.no/404page.php rewritecond %{http_host} ^www\.seoboost\.no$ rewriterule ^/?$ "https\:\/\/seoboost\.no\/" [r=301] rewritecond %{http_host} ^www\.example\.com$ rewriterule ^/?$ "https\:\/\/example\.com\/" [r=301,l] rewritecond %{http_user_agent} libwww-perl.* rewriterule .* ? [f] rewriterule ^index\.php$ / [r=301] rewriterule ^(.*)/index\.php$ /$1/ [r=301] 

i have try delete in htaccess , have code

rewriteengine on rewriterule ^([^/]*)\.html$ /category.php?cat=$1 [l] 

but still not working, server or doing wrong??

try replacing .htaccess with

rewriteengine on rewriterule ^category/(.*)$ /category.php?cat=$1 [l] 

which redirect yoursite.com/category/12 yoursite.com/category.php?cat=12 internally, , user never see "ugly" url. inside category.php file can access cat $category_id = $_get['cat']

a simple anchor tag looks this:

<a href="https://yoursite.com/category/12">item 12</a> 

Comments