Answer the question
In order to leave comments, you need to log in
How to setup rewriterule in htaccess for home page and categories?
I can't set up htaccess
Given:
1.domen.ru
2.I want to make domen.ru/namecat1/namecat2/ be passed to category.php $1 $2
3. so that the main page does not go to category.php if one domain is without domen slashes .ru ===>index.php
4. it turned out to do this, but when removing repeated slashes, it throws domen.ru/aaaa/user15/main/?category=namecat1/namecat2 to the server path,
but you just need to remove more than 2 slashes at the end
5. wrote code like this:
rewriterule ^(.*[^/]+)/?$ category=$1
was initially done with the addition of domen.ru/PRODUCTS/category1/category2/
everything worked well, just for SEO I want to remove products
there the line was like this:
rewriterule ^products/(.*[^/]+)/(.*[^/]+)/(.*[^/]+)/?$ category[]=$1&category=$2&category=$3
But if I remove products, then the main page also leads to category.php
I don’t understand how to write cond for improvement
Answer the question
In order to leave comments, you need to log in
Well, who told you that the GET parameter is part of the url?
Here you will have an example of how to make a redirect with get parameters.
https://donatstudios.com/RewriteRule_Generator
And here I wrote how to remove the category.
https://klondike-studio.ru/blog/snipet-for-htaccess/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question