0

At this moment, I am accessing my project pages like this and this formatting is working fine:

http://localhost/Seven/index.php/admin_login/login  (FOR LOGIN PAGE)

http://localhost/Seven/index.php/secure/admin_news  (FOR ADMIN NEWS SECTION)

config.php

$config['base_url'] = 'http://localhost/Seven/';

$config['index_page'] = 'index.php';

At this moment, I'm not using any .htaccess file as I couldn't access contents of my CSS.

My question

  1. How can I remove the "index.php" bit from my URLs, so that I could access my project pages like the following?

    http://localhost/Seven/admin_login/login  (FOR LOGIN PAGE)
    
    http://localhost/Seven/secure/admin_news  (FOR ADMIN NEWS SECTION)
    

    and all other pages ????

  2. I have two user folders in my project root directory ("Seven") for images and CSS, that is, "images" and "css". I am using my CSS and images like this:

    http://localhost/Seven/images/test-logo.jpg
    

    AND

    ../Seven/css/default.css
    

When I try to get rid of absolute paths, I fail to access my images and CSS contents on my web pages. How can I deal with this problem?

2 Answers 2

3

Open config/config.php, line 31:

Change

$config['index_page'] = 'index.php';

to

$config['index_page'] = '';

Then use this .htaccess (put it to the main root /Seven):

RewriteEngine On
RewriteBase /Seven
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /Seven/index.php/$1 [L]
Sign up to request clarification or add additional context in comments.

Comments

2

Just a note to make your life easier: do not supply base_url in the configuration unless you really need it.

I've never supplied it in any of my projects which makes it less painfull when uploading to multiple places (CodeIgniter can figure it out).

2 Comments

i agree! but to be sure i always use $_SERVER['HTTP_HOST'] inside
@ahmad.what could be the alternate solution?sorry.I am a new bee and would appreciate if you could explain it further?Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.