Trying to redirect all to https://www.....com/....
From :
http
non-www
to
https://www...... format
I have already tried following :
RewriteEngine on
RewriteCond %{HTTPS} !1 [NC]
RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC]
RewriteCond %{HTTP:X-Forwarded-SSL} !on [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI}$1 [R=301,L,QSA]
Environment ##
Ubuntu 22.04 LTS
Apache 2.4
SSL on
PHP Zend Framework, under public folder .htaccess ##
RewriteEngine On
The following rule tells Apache that if the requested filename exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [L]
The following rewrites all other queries to index.php. The
condition ensures that if you are using Apache aliases to do
mass virtual hosting or installed the project in a subdirectory,
the base path will be prepended to allow proper resolution of
the index.php file; it will work in non-aliased environments
as well, providing a safe, one-size fits all solution.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.)::\2$
RewriteRule ^(.) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}/index.php [L]
Enable gzip compression
application/javascript application/json application/font-woff application/font-woff2 image/svg+xml
<Files ~ ".(jpe?g|png|gif|css|js|woff|woff2|ttf|svg|webp|eot|ico)$">
<ifModule mod_headers.c> <br />
Header set Cache-Control "max-age=31536000, public" <br />
</ifModule> <br />
IfModule mod_expires.c <br />
ExpiresActive on <br />
ExpiresDefault "access plus 1 year" <br />
IfModule <br />
Disables auto directory index
IfModule mod_autoindex.c
Options -Indexes
IfModule
IfModule mod_negotiation.c
Options -MultiViews
IfModule
IfModule mod_headers.c
Header append X-Frame-Options SAMEORIGIN
Header always set Strict-Transport-Security "max-age=31536000"
IfModule