codeigniter 我想重定向到https,如果有人在Code Igniter PHP中使用http点击URL [重复]

zqdjd7g9  于 8个月前  发布在  PHP
关注(0)|答案(1)|浏览(62)

此问题已在此处有答案

Https to http redirect using htaccess(7个回答)
How to redirect http to https in codeigniter(13个回答)
10天前关闭。
我想重定向到https,如果有人在代码点火器PHP中使用http点击URL。我正在使用这个htaccess代码。帮我一下

Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

添加或更正htaccess代码。

0aydgbwb

0aydgbwb1#

Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine On

# Redirect HTTP to HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Rest of htaccess
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

在这里,你可以阅读更多关于将http重定向到https Https to http redirect using htaccess的信息。

相关问题