• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problem with htacces and https

#1
Hello
I've made simple htacess from manual:
Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

If I coming via http - it works
If I coming via https - it works, but changes the address in address line from https://example.com/zzz/ to https://example.com/index.php/zzz/ 

Code:
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

What can I do to remove this "index.php" from https links?
Reply

#2
(06-09-2017, 03:21 AM)kozebobinka Wrote: Hello
I've made simple htacess from manual:
Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

If I coming via http - it works
If I coming via https - it works, but changes the address in address line from https://example.com/zzz/ to https://example.com/index.php/zzz/ 

Code:
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

What can I do to remove this "index.php" from https links?

Try this .htaccess:


Code:
RewriteEngine On
RewriteBase /

# Entire site is secure
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://your-website.com/$1 [R,L]

RewriteRule ^(system|application|cgi-bin) - [F,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
Reply

#3
It's work! Thank you so much!
Reply

#4
this is the .htaccess file i used for my project in my localhost.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /test_abc/

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ ./index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ ./index.php?/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^(index.php|images|css|fonts|js|robots.txt)
</IfModule>

here test_abc is the folder name in my localhost.
when i type http://localhost/test_abc in the browser,it works properly in my localhost.

when i upload the content from my localhost into 000webhost.com server
i did the changes

in .htaccess file
RewriteBase into RewriteBase /http://www.example.com/

in config.php
$config['base_url'] = 'http://www.example.com/';
$config['index_page'] = '';

in routes.php
$route['default_controller'] = 'Login';

database.php file is ok

I can see the login page in 000webhost.com server properly, but when i try to login, it says "500 internal server error".

I'm new to this area and unable to handle this issue.
Is there any other changes i have to do here?
can any one please help me to upload my web site.
Reply

#5
(07-01-2017, 09:16 PM)jackey Wrote: this is the .htaccess file i used for my project in my localhost.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /test_abc/

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ ./index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ ./index.php?/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?/$1 [L]

RewriteCond %{REQUEST_URI} ^(index.php|images|css|fonts|js|robots.txt)
</IfModule>

here test_abc is the folder name in my localhost.
when i type http://localhost/test_abc in the browser,it works properly in my localhost.

when i upload the content from my localhost into 000webhost.com server
i did the changes

in .htaccess file
RewriteBase into RewriteBase /http://www.example.com/

in config.php
$config['base_url'] = 'http://www.example.com/';
$config['index_page'] = '';

in routes.php
$route['default_controller'] = 'Login';

database.php file is ok

I can see the login page in 000webhost.com server properly, but when i try to login, it says "500 internal server error".

I'm new to this area and unable to handle this issue.
Is there any other changes i have to do here?
can any one please help me to upload my web site.

500 is a server error. check the error log file
Reply

#6
Most likely caused by a syntax error / typo in your htaccess file.
Reply

#7
Quote:RewriteBase into RewriteBase /http://www.example.com/

You have a forward slash before your http in your post above, have you put this in your .htaccess file too? Take it out.
Reply

#8
(07-02-2017, 02:08 PM)PaulD Wrote:
Quote:RewriteBase into RewriteBase /http://www.example.com/

You have a forward slash before your http in your post above, have you put this in your .htaccess file too? Take it out.

Thank you very much for your support. Now it's working.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
2 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.