CodeIgniter Forums
results from site_url() - Printable Version

+- CodeIgniter Forums (
+-- Forum: Using CodeIgniter (
+--- Forum: General Help (
+--- Thread: results from site_url() (/showthread.php?tid=61482)

results from site_url() - cupboy - 04-18-2015

With version 2 it returns http://localhost:8055

With version 3 it returns http://localhost:8030/index.php

I am converting a ver. 2 site to ver. 3, but why did it append /index.php on there, and what can I do about it? It causes my images not to display for one thing.

RE: results from site_url() - suhindra - 04-19-2015

By default, the index.php file will be included in your URLs:


If your Apache server has mod_rewrite enabled, you can easily remove this file by using a .htaccess file with some simple rules. Here is an example of such a file, using the “negative” method in which everything is redirected except the specified items:

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

In the above example, any HTTP request other than those for existing directories and existing files is treated as a request for your index.php file.

RE: results from site_url() - cupboy - 04-19-2015

I tried that .htaccess file but it didn't change the results any.

RE: results from site_url() - CroNiX - 04-19-2015

Did you remove 'index.php' from index_page config setting in /application/config/config.php? That also needs to be done.
$config['index_page'] = '';

| 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';

RE: results from site_url() - cupboy - 04-19-2015

It's working at the moment. Hope it stays that way.

RE: results from site_url() - paju89 - 04-20-2015

(04-19-2015, 08:42 AM)cupboy Wrote: I tried that .htaccess file but it didn't change the results any.

hope this helps
<IfModule mod_rewrite.c>
RewriteEngine On
# !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
# slashes.
# If your page resides at
# then use
# RewriteBase /mypage/test1/
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

<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