boch112
@boch112
привет

Какая инструкция в .htaccess отвечает за то, чтобы страницы показывались без .html?

AddDefaultCharset UTF-8
AddHandler application/x-httpd-php .php .html
####
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
####
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.alp-sity.ru$ [NC]
RewriteRule ^(.*)$ https://alp-sity.ru/$1 [R=301,L]
####
RewriteRule ^(.+)/index\.html$ /$1/ [R=301,L]
####
RewriteEngine on
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+)\.html\ HTTP
RewriteRule ^([^.]+)\.html$ https://alp-sity.ru/$1 [R=301,L]
RewriteCond %{REQUEST_URI} !(\.[^./]+)$
RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule (.*) /$1.html [L]
Action php5.4-script /cgi-bin/php5.4.cgi
AddType php5.4-script .php
ErrorDocument 404 /404.html
#########################
  • Вопрос задан
  • 45 просмотров
Решения вопроса 1
@dodo512
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+)\.html\ HTTP
RewriteRule ^([^.]+)\.html$ https://alp-sity.ru/$1 [R=301,L]

Делает 301-й редирект с /file.html на /file

RewriteCond %{REQUEST_URI} !(\.[^./]+)$
RewriteCond %{REQUEST_fileNAME} !-d
RewriteCond %{REQUEST_fileNAME} !-f
RewriteRule (.*) /$1.html [L]

Делает внутреннее перенаправление с /file на /file.html
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы