I
I
Ivan2021-08-28 15:18:13
htaccess
Ivan, 2021-08-28 15:18:13

How to optimize .htaccess for page redirect?

When I open certain pages on the site, I need to open them but load a certain script.

Here is an example of two pages :

https://site.ru/9.2040392295441-matic-usd/
and
https://site.ru/matic-2021-08-01/

usd/ the page https://site.ru/matic-2021-08-01/ was opened by loading dashboard.php
and when the page https://site.ru/9.2040392295441-matic-usd/ was opened, dashbord2.php was loaded
keeping the original url addresses in the browser

I did this:


RewriteRule ^([az]+)-([0-9]+)-([0-9]+)-([0-9]+)/?$ dashboard.php?id=$1 [L]
RewriteRule ^ ([.0-9]+)-([az]+)-([az]+)/?$ dashboard2.php?id=$1 [L]


Can you somehow optimize, simplify?

Thank you!

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