Welcome Guest, Not a member yet? Register   Sign In
Removing index.php From Pre-Built Site
#1

[eluser]Unknown[/eluser]
Hi There,

Totally new to CodeIgniter but been using EE for a while now so I'm not completely in the dark.

I was kind of handed this pre-built CodeIgniter site to revise and launch, and I'm having some trouble with the URLs. The links are set to go to pages without index.php. "No problem" I think, I'll just upload the standard "negative" method .htaccess file and we'll be all set. Well doing that completely removed all styles and images from the site.

What else should I try to get these index.php-less URLs working? Another type of .htaccess file? I'd rather not add index.php to the links if I don't have to...

Thanks!
#2

[eluser]sean_THR[/eluser]
When referencing your assets such as images, stylesheets, JS, etc, you may need to give an absolute URL to them rather than relative.

For example, on most of my sites, I use something similar to this:
Code:
<?=base_url();?>/assets/cs/style.css
#3

[eluser]veritascs[/eluser]
Also make sure in your htaccess file you have the condition to allow access to your assets (ie images/js/css/etc).

This what I use:
Code:
#remove index.php from URL
RewriteEngine on
RewriteCond $1 !^(index\.php|cgi-bin|css|images|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]
#4

[eluser]Unknown[/eluser]
Worked like a charm! Thanks veritascs!




Theme © iAndrew 2016 - Forum software by © MyBB