I am trying to create pretty URL from my site, but I still newbie in .htaccess , I am so confuse to do it.
Original URL:
1. mysite.com/index.php?mode=frontend&act=viewArtikel&cat=hotnews&year=2017&month=02&link=hello-world
2. mysite.com/index.php?mode=frontend&act=viewProduct&cat=food&link=pizza
Expected:
1. mysite.com/hotnews/2017/02/hello-world.html
2. mysite.com/food/pizza.html
How to do it? Thanks in advance ps: please don't mark this post duplicate, sorry for my bad English
Try below rule,
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\w-]+)/([\d]{4}+)/([\d]{2}+)/([\w-]+)\.html$ index.php?mode=frontend&act=viewArtikel&cat=$1&year=$2&month=$3&link=$4 [L]
RewriteRule ^([\w-]+)/([\w-]+)\.html$ index.php?mode=frontend&act=viewProduct&cat=$1&link=$2 [L]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.