小编asi*_*han的帖子

如何在codeigniter中将http重定向到https

点#1 如果我键入:

www.myurl.com/somepage
http://www.myurl.com/somepage
http://myurl.com/somepage
https://myurl.com/somepage
Run Code Online (Sandbox Code Playgroud)

让它重定向到

https://www.myurl.com/somepage
Run Code Online (Sandbox Code Playgroud)

第2点

When I type in something like www.myurl.com it is redirecting to https://www.myurl.com/index.php.
Make it so the index.php is not displaying. It should just display https://www.myurl.com
Run Code Online (Sandbox Code Playgroud)

来自评论htaccess

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^myhost\.com$ [NC] 
RewriteRule ^(.*)$ myhost.com/$1 [R=301,L] 
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /index\.php(/[^\ ]*)?\ HTTP/ 
RewriteRule ^index\.php(/(.*))?$ myhost.com/$2 [R=301,L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L] 
Run Code Online (Sandbox Code Playgroud)

php .htaccess codeigniter

16
推荐指数
5
解决办法
3万
查看次数

标签 统计

.htaccess ×1

codeigniter ×1

php ×1