V
V
viktorross2022-01-09 06:52:15
htaccess
viktorross, 2022-01-09 06:52:15

How to use different redirect options in htaccess?

hello, I have such a problem, I need to register various link options in htaccess, but only the first ones work, the next one is ignored, how to fix it?

RewriteRule ^search/([^./]+)/([^./]+) q.php?category_slug=$1&region_slug=$2 [nc,qsa] - работает
  RewriteRule ^search/([^./]+)/([^./]+) q.php?region_slug=$1&category_slug=$2 [nc,qsa] - не работает
  RewriteRule ^search/([^./]+) q.php?category_slug=$1 [nc,qsa] - работает
  RewriteRule ^search/([^./]+) q.php?region_slug=$2 [nc,qsa] - не работает 
  RewriteRule ^search/([^./]+) q.php?region_slug=$1 [nc,qsa] - не работает
  RewriteRule ^search/([^./]+) q.php?category_slug=$2 [nc,qsa] - не работает


please tell me how to do it right so that there are all these options

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor Taran, 2022-01-09
@shambler81

uh
, how do you think it should work?
You "had" the same in all conditions!
Tell me about your logic, how it should work according to your idea?
if I switched to
search/1 - what should I get as a result? according to your logic, I should get 4 urls at once?

V
viktorross, 2022-01-10
@viktorross

Viktor Taran , to be honest, I don’t understand almost anything in htaccess, I only know what I wrote, I just need to at least have an absence option

RewriteRule ^search/([^./]+)/([^./]+) q.php?category_slug=$1&region_slug=$2&param=$3 [nc,qsa]

either replace it
?category_slug=$1with at least some number, for example 0

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question