[英]https redirect of subdirectory using htaccess does not work for inner url
I am trying to redirect subdirectory from http to https. 我正在尝试将子目录从http重定向到https。 I am using codeigniter as framework :
我使用codeigniter作为框架:
http(s)://www.abc.com/new/
Here is my htaccess looks like this 这是我的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]
Now when I access my site using 现在,当我使用
abc.com/new
then it redirects to me to 然后重定向到我
http(s)://www.abc.com
which is fine but when I directly hit any inner url like 很好,但是当我直接点击任何内部网址时
abc.com/new/customer/customer_list
then it does not redirects me to http(s) Can anyone solve my issue ? 那么它不会将我重定向到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]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.