Welcome Guest, Not a member yet? Register   Sign In
HTTP/HTTPS, without index.php, using htaccess, plus XHR
#11

[eluser]jpwdesigns[/eluser]
Awesome work guys. Thanks for sharing the easiest method of dealing with ssl i've seen yet.

One issue i'm having is that the base url is not converting to http: when i access from a page which is https:.

EXAMPLE:
Enter site at home page -> link to ssl page -> click link "Home" button to be redirected back to base url but it does not revert to http.

Ideas?
#12

[eluser]baazil1[/eluser]
I have followed this exactly... what gives? Why does this not work? How can this be the only post referencing this issue?

My .htaccess file:
Code:
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /

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

    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /index.php
</IfModule>

It works to the point that everything is being forced to https://intranet.domain.org, but NO SUB LINKS ARE WORKING...

https://intranet.domain.org/test does not work

however

https://intranet.domain.org/index.php/test works

According to this post, the above should be the exact opposite. What am I doing wrong here?
#13

[eluser]baazil1[/eluser]
If it matters... the logs say this when accessing https://intranet.domain.org/test

[Fri Jun 15 09:11:58 2012] [error] [client 10.1.0.17] File does not exist: C:/Webserver/htdocs/intranet/test, referer: https://intranet.domain.org/

And this is what my URLs look like, as when I am linking to a different section:

Code:
<a href="&lt;?php echo base_url()?&gt;test"><span>test</span></a>

The above takes me to https://intranet.domain.org/test, however, a
Not Found
The requested URL /test was not found on this server.
#14

[eluser]touson[/eluser]
Thank you thank you thank you thank you thank you thank you. I was starting to lose the will to live, then you came out of the adrkness like a guiding light. WOW, I know, what a review!!!
#15

[eluser]Unknown[/eluser]
For some reason the .htaccess versions from Phil_b and terminate were not working for me but the following does.
I read on other forums that the remove index rule for codeigniter should go at the bottom, that is after the HTTP/HTTPS handling, and then in that case I had to remove the L definition for those two rules.

This was really giving me headaches, so am posting just in case anyone else experience the same issues as me. I am not sure about what was causing the difference though as the versions posted here should have worked in theory. The only difference I see is that I have codeigniter placed in a subfolder on my server.

Code:
RewriteEngine on

Options +FollowSymLinks

RewriteBase /subfolder/

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} (auth|register|secure|payment)
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,QSA]

RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(static|auth|register|secure|payment)
RewriteRule ^(.*)$ http://%{SERVER_NAME}%{REQUEST_URI} [R=301,QSA]


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1
#16

[eluser]jordanarseno[/eluser]
@Manisha and @baazil1,

Make sure that .htaccess is effectively "turned on".
Find your default-ssl file (or equivalent) on your system.

On Ubuntu it's here: /etc/apache2/sites-available/default-ssl and modify as per below.

Code:
<Directory /var/www/>
  Options Indexes FollowSymLinks MultiViews
  AllowOverride All
  Order allow,deny
  allow from all
</Directory>

The key here is the
Code:
AllowOverride All
.

In your case it is probably set to
Code:
AllowOverride None
.

Does this help?
#17

[eluser]Unknown[/eluser]
Hello,

Can you please advise mE where should i include $config['base_url'] = "http".((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "s" : "")."://".$_SERVER['HTTP part before dealing the the .htaccess

Thank you
#18

[eluser]mlieshout[/eluser]
Hi,

This solution works perfect for me except that the redirect to https brings back the index.php and does not go away. How can I fix that?

Never mind, I've found the answer Smile

http://stackoverflow.com/questions/19563...-index-php




Theme © iAndrew 2016 - Forum software by © MyBB