使用htaccess的子目录HTTPS重定向对内部url不起作用


https redirect of subdirectory using htaccess does not work for inner url

我试图将子目录从http重定向到https。我使用codeigniter作为框架:

http(s)://www.abc.com/new/

我的htaccess是这样的

RewriteEngine On
RewriteBase /new/
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} !^/new
RewriteCond %{QUERY_STRING} !^/new
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_URI}  !('.png|'.pdf|'.jpg|'.gif|'.jpeg|'.bmp|'.js|'.css|'.html|'.php|'.txt|'.ttf|'.svg|'.woff|'.woff2)$
RewriteCond %{REQUEST_URI}  !js_elements
RewriteRule ^(.*)$ index.php?/$1 [L]

现在当我使用

访问我的网站时
abc.com/new 

然后重定向到

http(s)://www.abc.com 

可以但是当我直接点击任何内部url,比如

abc.com/new/customer/customer_list

那么它不会重定向到http(s)谁能解决我的问题?

Current folder layout
-index.php
-/xyz
    -index.php
your requirement is to turn this url
http://example.com/xyz/?username=xyz
into this url
http://example.com/xyz1/xyz

-----
use this code inside /xyz/.htaccess:
DirectoryIndex index.php
RewriteEngine On
RewriteBase /xyz/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$ index.php?xyz=$1 [L,QSA]