How to redirect from subdirectory to directory via htaccess?
-
There is a page " my-tests3.pp.ua/markizy-pod-zakaz/amp ", but I noticed that all pages named" my -tests3.pp.ua/markizy-pod-zakaz/amp/1 "and in general" http: //my-tests3.pp.ua/markizy-pod-zakaz/amp/all ... "displays the same page.
The question is simple - how to write a redirect from any page after " my-tests3.pp.ua / markizy-pod-zakaz / amp "to the same page. To get something like this:
my-tests3.pp.ua/markizy-pod-zakaz/amp - does not redirect
my-tests3.pp.ua/markizy-pod-zakaz/amp/ 1 - redirect to my-tests3.pp.ua/markizy- pod-zakaz / amp
my-tests3.pp.ua/markizy-pod-zakaz/amp/adfsdf - redirect to my-tests3.pp.ua/markizy-pod -zakaz / amp
my-tests3.pp.ua/amp/1 - redirect to my-tests3.pp.ua/amp
my-tests3.pp.ua/amp/sdcfsdf - redirect to my-tests3.pp.ua/amphtaccess Anonymous, Apr 3, 2020 -
Add
to the top of the .htaccess file
RewriteRule ^ ((. + /)? amp /).+$ / $ 1 [R = 301, L]
Leah Chapman
1 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!