Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1075919 Posts in 44152 Topics- by 36120 Members - Latest Member: Royalhandstudios

December 29, 2014, 03:33:48 PM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)htaccess issue
Pages: [1]
Print
Author Topic: htaccess issue  (Read 536 times)
ChevyRay
Guest
« on: August 14, 2010, 08:06:02 AM »

Hey webfolks, could use some help!

I'm setting up my website with CodeIgniter, and all is going well so far. CI uses a uri segment system, so a link to my blog might look something like this:

example.com/index.php/blog/page/1

So I'm using this .htaccess file to remove that index.php out of there...

Code:
RewriteEngine On
RewriteCond $1 !^(index\.php)
RewriteRule ^(.+)$ index.php?$1 [L]

I know nothing about this, so it could be completely wrong (I borrowed the code from somewhere else). It seems to work fine, allowing me to just use this to go to the same page:

example.com/blog/page/1

But it gives me one problem. I store other information on the root, such as the stylesheet and the graphics folder:

example.com/style.css
example.com/gfx/

Dropping that .htaccess folder in the root makes it so I can't access those files, which I assume is because it's [re-]inserting index.php in there after the root. This htaccess code was just pulled from some place online, and I'm having a difficult time making sense of it. Is there a way to make it so it ignores these files, or I can make it ignore folders/files that actually exist, or is that beyond the scope of htaccess?

Still really a novice at this, so thanks for any help.
Logged
Noel Berry
Level 4
****


Yarr!


View Profile WWW Email
« Reply #1 on: August 14, 2010, 08:20:44 AM »

I know wordpress does things where it doesn't rewrite if there are actual files or directories that exist. So if there's a directory called "monkey" putting in /monkey/ will bring you to the directory, rather than index.php?monkey or whatever.

May or may not work.. I don't know htaccess that well, but it's worth a shot!
Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

I would put that just after setting the rewrite engine to on.

Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php)
RewriteRule ^(.+)$ index.php?$1 [L]
« Last Edit: August 14, 2010, 08:24:08 AM by Noel » Logged

ChevyRay
Guest
« Reply #2 on: August 14, 2010, 08:22:10 AM »

It workedddd!! Kiss
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic