M
M
Mark Secretov2020-07-29 19:14:13
htaccess
Mark Secretov, 2020-07-29 19:14:13

How to merge 2 .htaccess into one?

1. Code: (for protected)

RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]

2. Code: (to remove from .html pages)
RewriteEngine On
RewriteCond %{REQUEST_URI} ! \.html$
RewriteCond %{REQUEST_URI} ! /$
RewriteRule ^(.*)$ $1.html


If you just copy-paste - error 500

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2020-07-29
@dimonchik2013

first 2 then 1

V
Viktor Taran, 2020-08-03
@shambler81

RewriteEngine On

RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]

RewriteCond %{REQUEST_URI} ! \.html$
RewriteCond %{REQUEST_URI} ! /$
RewriteRule ^(.*)$ $1.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question