S
S
SidorKovpak2018-05-31 11:09:59
Apache HTTP Server
SidorKovpak, 2018-05-31 11:09:59

Redirect from http to https (+ subdomains) and index.php pops up. What is the reason?

Good afternoon dear community.
There was a problem when switching from http to https.
I post the code of the .htaccess file (without br. caching, compression)

RewriteEngine on

RewriteCond %{HTTP_HOST} ^www\.(.*)$
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

RewriteCond %{REQUEST_URI} !\?
RewriteCond %{REQUEST_URI} !\&
RewriteCond %{REQUEST_URI} !\=
RewriteCond %{REQUEST_URI} !\.
RewriteCond %{REQUEST_URI} !\/$
RewriteCond %{REQUEST_METHOD}  !=POST
RewriteRule ^(.*[^\/])$ /$1/ [R=301,L]

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php?/$0 [PT,L]

This is how everything works, index.php is not added to the URLs.
I add a couple of lines before the redirect from www to without www:
RewriteCond %{ENV:HTTPS} !on
RewriteRule ^(.*)$ https://%1/$1 [L,R=301]

The redirect works, but index.php is added to all links.
The link is as follows: https://domain.ru/index.php?/corporacia-632/
It is necessary that it be: https://domain.ru/corporacia-632/
What you didn’t do, you can’t remove it.
The script on codeigniter 3. Everything is fine in the configs (it works fine without a redirect, there is a problem with transferring to https)
Hosted site.
Tell me, what could be the reason?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2018-05-31
@shambler81

RewriteCond %{ENV:HTTPS} !on
RewriteRule ^(.*)$ https://%1/$1 [L,R=301]

What do you think this rule should do?
Especially%1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question