Here you need to use
RewriteEngine On RewriteBase / RewriteRule ^([a-z0-9\-_]+)/?$ index.php?part=$1&type=all&model=all&page=index [L,NC] RewriteRule ^([a-z0-9\-_]+)/([a-z0-9\-_]+)/?$ index.php?part=$1&type=$2&model=all&page=index [L,NC] RewriteRule ^([a-z0-9\-_]+)/([a-z0-9\-_]+)/([a-z0-9\-_]+)/?$ index.php?part=$1&type=$2&model=$3&page=index [L,NC] RewriteRule ^([a-z0-9\-_]+)/([a-z0-9\-_]+)/([a-z0-9\-_]+)/([a-z0-9\-_\.]+)\.html$ index.php?part=$1&type=$2&model=$3&page=$4 [L,NC]
Therefore, when the folder (CERAMIC example) is not specified, you can add a flag to load all, as the idea for the model. This means that if only the first part is provided, then only the first rule will be used. Starting with page.html
by default, you can load the index.
Now a-z0-9\-_
means only letters, numbers, dashes and underscores ONLY. You can use ([^/]+)
if you want you can use more characters.
A value of L means last
, meaning that if the rule matches, it will stop. NC is not a case, so A = a or ABC = abc.
source share