A
A
Alexander2019-02-07 19:04:20
Apache HTTP Server
Alexander, 2019-02-07 19:04:20

Is it possible to use MOD_REWRITE for multiple GET parameters?

Is it possible to use MOD_REWRITE for links that pass a different number of GET parameters and are ordered differently, and their number is different?
The link may look like

  • localhost/index.php? nav=Main && page=21
  • localhost/index.php? category=Old && nav=search && page=21
  • localhost/index.php? category=Old && tags=News%20Music && page=21 && nav=search

Or should GETs always be ordered and their number and name should be clearly defined and spelled out? Killed all day, and did not understand. In all examples they are ordered, or only one variable is used at all.
This means that the links will not have a clearly the same type, but different. Or is it impossible to do so?
  • localhost/Var1/Value1 -> localhost/index.php?Var1=Value1
  • localhost/Var2/Value2/Var1/Value1 -> localhost/index.php?Var2=Value2&&Var1=Value1
  • localhost/Var3/Value3/Var1/Value1/Var2/Value2 -> localhost/index.php?Value3=Var3&&Var1=Value1&&Var2=Value2

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2019-02-12
@Ic2d

Yes, it’s possible not you both are wrong, everything is much more interesting there.
One way example

# 301 --- http://www.test3.com/faq.html?faq=13&layout=bob => bbq.html
RewriteCond %{QUERY_STRING} (^|&)faq\=13($|&)
RewriteCond %{QUERY_STRING} (^|&)layout\=bob($|&)
RewriteRule ^faq\.html$ /bbq.html? [L,R=301]

In another one it's even more fun, create groups in RewriteCond and insert them into the wheel instead of $1 (it is covered by the wheel itself) insert %1
BUT
You don't need this you need CNC and your question sounds like how to make CNC?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question