2

I've setup a test SSL certificate using this tutorial. My application requires user authentication. As expected, I get an error message when loading the login page. When I try to navigate to any other page or submit the login form, I get a 404 error message.

My assumption is that all of the URLs since they are created by the controllers, are not being rewritten anymore in the .htaccess. I am unclear how to fix this issue so that all of my URLs work other than the base index.php file.

My server details are as follows:

  • Apache2
  • Ubuntu 12.04
  • Codeigniter 2 (some version of 2)

Here is my .htaccess file:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
     RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    #When your application folder isn't in the system folder
    #This snippet prevents user access to the application folder
    #Submitted by: Fabdrol
    #Rename 'application' to your applications folder name.
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>

1 Answer 1

3

You need to set the AllowOverride directive in your apache configuration.

Change AllowOverride None to AllowOverride All

Set Allow Override

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. This solved the issue. A quick note incase this helps anyone, my setup was slightly different, instead of within the apache2/apache.conf I had to make the change to my apache2/sites-available/default-ssl.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.