L
L
leoner2018-11-04 10:07:41
htaccess
leoner, 2018-11-04 10:07:41

Issuing a 301 redirect link through a folder to a page?

Hello. There was a conflict when transferring the site to a new CNC.
The old page looked like this:
/dir/page/
We need to redirect to
/dir/page.html
This is understandable, I'm writing the simplest one.
Redirect 301 /dir/page/ /dir/page.html
But at the same time, all nested pages in the "/dir/page/" directory are translated into "/dir/page.html/one.html".
How to avoid this conflict? There are a lot of nested pages in this directory.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2018-11-04
@leoner

RedirectMatch 301 ^/dir/page/$ /dir/page.html
Or add to the beginning of the file:

RewriteEngine On

RewriteRule ^dir/page/$ /dir/page.html [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question