Welcome Guest, Not a member yet? Register   Sign In
removing index.php from url
#1

Hi

Like the title says i'm trying to remove index.php from the url so instead of

Code:
http://localhost/index.php/login

i can just write

Code:
http://localhost/login

I created a htaccess file and put it in the same directory as index.php (which is also the directory containing application directory, system directory, etc. All i wrote in the htaccess file is whats recommended in CI3 documentation:

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

However when i upload the website and type in
Code:
http://localhost/login

i get the error:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.
Apache/2.4.9 (Win32) PHP/5.5.12 Server at localhost Port 80.

What am i doing wrong?

Thanks
Reply
#2

(This post was last modified: 09-21-2015, 10:22 AM by PaulD. Edit Reason: Adding PS for clarification )

Have you changed the config file?

Quote:/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = 'index.php';  <-- need to remove this

Also, depending on the software you are using, local host may need some additional formatting. For instance, with XAMMP you need to change the httpd.conf file in the configuration of the apache server to allow overrides.

Quote:# AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride All   <--- change this from "None" to "All"

Hope that helps,

Best wishes,

Paul.

PS As it says in the docs your particular .htaccess rules many need to be configured for your particular environment too. That is just a sample .htaccess file. http://www.codeigniter.com/user_guide/ge...x-php-file
Reply




Theme © iAndrew 2016 - Forum software by © MyBB