aidonsnous
aidonsnous

Reputation: 1503

How can I Implement HTTPS for all pages Yii2

I want all pages of my website(website and restfull api) to be accessed via https. Following this post(Yii 1.1: URL management for Websites with secure and nonsecure pages), I understand that it is for a website that will have nonsecure and secure pages.

should I do it as explained the post or there is a specific way for website for which everything uses https?

Upvotes: 0

Views: 576

Answers (1)

Jake
Jake

Reputation: 136

You might need something like this in your .htaccess file

RewriteEngine on
RewriteBase /frontend/web/

RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,NE,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]

Upvotes: 1

Related Questions