M
M
mydarck2021-06-07 14:52:14
htaccess
mydarck, 2021-06-07 14:52:14

How to write a redirect to go to the main page from pages of the same type?

There are pages like https://site.ru/amp/1.html . Only the numbers change. I wrote a redirect, but it doesn't work:
Redirect 301 ^amp\/[0-9]*\.html$ https://site.ru . Tell me, please, how to do it right?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2021-06-07
@mydarck

The template ^ampwill work in RewriteRule, but for RedirectMatch you need to add "/"^/amp

RedirectMatch 301 ^/amp/[0-9]*\.html$ https://site.ru/

RewriteRule ^amp/[0-9]*\.html$ https://site.ru/ [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question