Domanda

I want my whole site under https. So I did two things:

1.I changed my base_url in the config.php to

https://localhost/codeignitor.

from

http://localhost/codeignitor.

2.My changed .htaccess file:

DirectoryIndex index.php

RewriteEngine on

RewriteCond $1 !^(index\.php|images|css|codeignitor|include|js|robots\.txt|favicon\.ico)

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ ./index.php/$1 [QSA]

# The following two lines newly added

RewriteCond %{HTTPS} off # To redirect all the http to https

RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301]

But when I visit

http://localhost/codeignitor/mysite

this is my error [Though it get redirected to https]

Not Found

The requested URL /codeignitor/my_site was not found on this server.

But

https://localhost/codeignitor/index.php/my_site

is woking fine.

È stato utile?

Soluzione

Seems .htaccess is not read in your https server config and you're using LAMP (Apache) so please go to your server config location for https, e.g. default-ssl or httpd-ssl.conf, and make sure AllowOverride is turned on. If you don't the line, you will need to add that.

<Directory /your/directory/to/codeigniter/>
    AllowOverride all
</Directory>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top