Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411722 Posts in 69402 Topics- by 58450 Members - Latest Member: FezzikTheGiant

May 22, 2024, 01:49:29 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)htaccess issue
Pages: [1]
Print
Author Topic: htaccess issue  (Read 800 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
« 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