G
G
generate2020-08-13 08:06:26
htaccess
generate, 2020-08-13 08:06:26

How to get htacces GET parameters?

I did this, you need to get the id the site opens and works along the path site.ru/mod/
RewriteRule ^mod(/?)+$ index.php?do=mod&id=$1 [L]
I automatically set the first parameter and want to get the second one, how can I pass it?
I tried these methods but they give errors
site.ru/mod/1
site.ru/mod/id/1
site.ru/mod?id1
site.ru/mod/id1
I wanted it to be transmitted like this site.ru/mod/1

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
generate, 2020-08-13
@generate

RewriteRule ^mod/([0-9]+)(/?)$ index.php?do=mod&id=$1 [L]

Found if anyone needs

V
Viktor Taran, 2020-08-13
@shambler81

I read it five times before understanding what you want, and then I understood it from the answer of my colleague.
Here's another option for you if the first one doesn't work, on some web servers you need to comment on the special character "?"
well, a slightly different post

RewriteRule ^mod/([0-9]1,)(/?)$ index.php\?do=mod&id=$1 [L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question