Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6253587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:01:36+00:00 2026-05-24T14:01:36+00:00

I have CodeIgniter without /index.php/ URL and i want to link CSS file in

  • 0

I have CodeIgniter without /index.php/ URL and i want to link CSS file in views.

My .htaccess:

RewriteEngine on
RewriteCond $1 !^([a-zA-z0-9/])
RewriteRule ^(.*)$ index.php [L]
RewriteCond $1 !^(index.php|images|robots.txt|system|user_guide)
RewriteRule ^(.*)$ index.php/$1 [L]

My link:

<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>application/views/metrohacker/style.css" />

With /index.php/ it works, but i want simple URL…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T14:01:37+00:00Added an answer on May 24, 2026 at 2:01 pm

    It’s because your application folder isn’t in the list of folders that aren’t rewritten in your htaccess file.

    RewriteCond $1 !^(index.php|images|robots.txt|system|user_guide)
    

    I would keep your CSS files in the root of the app rather than in the views folder. I would do the same with your JavaScripts and images too. That way your folder structure would be something like:

    root/
        application/
        assets/
            css/
            js/
            images/
        system/
    ...
    

    Make sure to add the assets folder to your .htaccess:

    RewriteCond $1 !^(index.php|images|robots.txt|system|user_guide|assets)
    

    Then you don’t have to worry about index.php doing the routing and you can just load a CSS file like so:

    <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>assets/css/style.css" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My current .htacces file looks like this: DirectoryIndex index.php RewriteEngine on RewriteCond $1 !^(index\.php|assets|robots\.txt|favicon\.ico)
i use a simple PHP framework (like Codeigniter) without ORM. I have a database
In Kohana/CodeIgniter, I can have a URL in this form: http://www.name.tld/controller_name/method_name/parameter_1/parameter_2/parameter_3 ... And then
I have used PHP for awhile now and have used it well with CodeIgniter,
I have a CodeIgniter project. I want to use Memcache, but I don't want
So I have a PHP CodeIgniter webapp and am trying to decide whether to
I have tried by myself to install Rediska (Redis PHP client) into my codeigniter
I have this htaccess code. What I want to accomplish is be able to
I'm new to PHP/MySQL and super-new to CodeIgniter.. I have information in many MySQL
I have created a symlink (using ln -s index.php test) to my index.php to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.