相关疑难解决方法(0)

强制https:// www.对于使用mod_rewrite的htaccess中的Codeigniter

我正在使用Codeigniter并按照这些说明强制ssl,但所有请求都被重定向到

http://staging.example.com/index.php/https:/staging.example.com
Run Code Online (Sandbox Code Playgroud)

.htaccess是:

### Canonicalize codeigniter URLs

# Enforce SSL https://www. 
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

###
# Removes access to the system folder by users.
# Additionally this will allow you to create a System.php controller,
# previously this would not have been possible.
# 'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]

# Checks to see if the user is attempting to …
Run Code Online (Sandbox Code Playgroud)

php .htaccess mod-rewrite codeigniter

13
推荐指数
3
解决办法
4万
查看次数

.htaccess - 尝试强制https时"重定向太多"

我试图强制我的根域的子文件夹(/ bbb /)始终显示为https.我的.htaccess文件也处理页面的扩展.

我把.htaccess文件放在我的/bbb/文件夹中,但当我试图强制连接到https时,我得到"太多的重定向",没有它一切正常.

我的代码有什么问题?

Options +FollowSymLinks -MultiViews
Options +Indexes
AcceptPathInfo Off
RewriteEngine on
RewriteBase   /

ErrorDocument 404 https://example.co.uk/404page/404.html

#Force from http to https
RewriteCond %{SERVER_PORT} 80 
RewriteCond %{HTTP_HOST} !^bbb.example.co.uk/$
RewriteRule ^(.*)$ https://bbb.example.co.uk/$1 [R=301]

#take off index.html
 RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{REQUEST_URI} ^(.*/)index\.html$ [NC]
RewriteRule . http://www.%{HTTP_HOST}%1 [R=301,NE,L]

## hide .php extension
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]

## To internally redirect /dir/foo to …
Run Code Online (Sandbox Code Playgroud)

.htaccess mod-rewrite redirect

9
推荐指数
4
解决办法
2万
查看次数

标签 统计

.htaccess ×2

mod-rewrite ×2

codeigniter ×1

php ×1

redirect ×1