Forum Moderators: phranque

Message Too Old, No Replies

.htaccess causing something strange after someone else edited it.

         

Perfection

4:06 pm on Oct 11, 2007 (gmt 0)

10+ Year Member



Someone did some work on a site of mine, and they edited the .htaccess file (which is perfectly fine). However, I think something they did is restricting access to sub directories. Let me explain...

Currently I get a 404 error if I try to access domain.com/stuff/ BUT if I go to domain.com/stuff/file.html, it works fine. It seems like all roots of all subdirectories are giving me 404 errors.

This is what they put in the .htaccess file:

RewriteCond $1!\.(php¦ico¦gif¦jpg¦png¦css¦js¦htm¦html¦txt¦zip¦pdf)$
RewriteCond $1!^$
RewriteCond %{REQUEST_FILENAME}!-f
RewriteRule ^(.*)$ index.php?/$1 [L]

I'm not really sure what any of that means, but I do know it's doing something important. At the same time, and I'm only really guessing here, I think it's the cause of my problem. If it's not, then I have absolutely no idea what could be causing this.

Any help would be very much appreciated.

[edited by: Perfection at 4:58 pm (utc) on Oct. 11, 2007]

jdMorgan

5:42 pm on Oct 11, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do these 'roots of all subdirectories' exist as actual index files, or is it your intent that your script generate content for those URLs?

Jim

Perfection

5:50 pm on Oct 11, 2007 (gmt 0)

10+ Year Member



The roots are all real index files.

I just did some reading (should have done so before posting) and I think I may know what I need to add to .htaccess to correct this.

RewriteCond %{REQUEST_FILENAME}!-d

Sound about right?

jdMorgan

6:27 pm on Oct 11, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not sure yet, based on current discussion... But it would make sense to try that.

Make sure you've got a space between "}" and "!" in that directive and also in the "file exists" check in the code previously posted above -- Posting on this forum eats those spaces unless steps are taken to prevent it.

Jim

Perfection

7:35 pm on Oct 11, 2007 (gmt 0)

10+ Year Member



Adding that line seemed to do the trick. As far as I can tell, everything is working properly.

Thanks for the help.