C
C
Cheizer2020-05-21 13:31:25
Regular Expressions
Cheizer, 2020-05-21 13:31:25

How to change URL using regular expression in HTACCESS?

Greetings gurus of the regular season, I'm completely weak in it, I need your help!

There is a site running CMS MODX REVO displaying articles by tags.
The URL on the article output page for tags of this kind:

/tag?tag=mytag

Through suffering and searching, changed it as it should using the expression in the HTACCESS

RewriteRule ^tag/(.*)$ /tag?tag=$1 [L]

now as it should outputs
/tag/mytag

BUT there is also pagination and it breaks the url :( from this
/tag/mytag

makes it
/tag?page=2&tag=mytag

how to add regex to be like this
/tag/mytag?page=2

or best of all!?
/tag/mytag/page/2

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question