S
S
SvetlanaSV2019-07-16 10:09:24
1C-Bitrix
SvetlanaSV, 2019-07-16 10:09:24

301 redirect from pages with html to without html co /?

Good afternoon.
A new website is being launched and the structure is changing.
Registered 301 redirects of the form

Redirect 301 /kontakty/ http: //site.ru/company/contacts/
- that's how it works
Redirect 301 /catalog/product1.html http: //site.ru/catalog/product1/
- so no - goes to the view page
http://site.ru/catalog/product1/product1.htm
l - that is, it always does the redirect as it should, but adds .html
Maybe someone knows how to write redirects from html for specific pages and not in general for the entire site.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
rusikus, 2019-07-16
@rusikus

it is described here

S
SvetlanaSV, 2019-07-16
@SvetlanaSV

RewriteEngine on
RewriteBase /
RewriteCond %{THE_REQUEST} ^[AZ]{3,9}\ /([^.]+)\.html\ HTTP
RewriteRule ^([^.]+)\.html$ site.ru/$1 [R=301,L]
RewriteCond %{REQUEST_URI} !(\.[^./]+)$
RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule (.*) /$1.html
site Replace .ru with the domain of your site.
In .htaccess. Accessing /about.html redirects to /about. I myself use this option, and I advise you.
This method only removes the html tail, and I need a link to a different page in principle .
type
Redirect 301 site.ru/catalog/whitecat.html to site. ru/commodity/blackdog/

V
Viktor Taran, 2019-07-16
@shambler81

I signed everything in detail here, and brought it to the standard
https://klondike-studio.ru/standards/standartnyy-h...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question