Forum Moderators: phranque

Message Too Old, No Replies

.htaccess with IPB forum, supposed to exclude dir, still get errors

         

tekp

8:17 pm on Oct 26, 2005 (gmt 0)

10+ Year Member



Oooo-k:

I have the following in my .htaccess:

RewriteEngine on
RewriteRule!(^/forums/.*$¦\.(gif¦css¦jpg¦png¦js¦asf¦avi¦wmv¦swf¦xsl¦jar¦ inc.php))$ /includes/request.inc.php

I also have IPB forums in the /forums/ directory. The .htaccess is supposed to redirect all server requests except those inside the /forums/ directory (and except those with the filenames specified).

When I try to go on the forum I am told the following:

Warning: main(./conf_global.php): failed to open stream: No such file or directory in /home/tekp/public_html/forums/index.php on line 107

Warning: main(./conf_global.php): failed to open stream: No such file or directory in /home/tekp/public_html/forums/index.php on line 107

Any suggestions? Cheers :D

jdMorgan

9:00 pm on Oct 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, let's see if we can get this working first, and see if that's the only problem:

RewriteEngine on
RewriteRule !(^forums/¦(\.(asf¦avi¦css¦gif¦inc\.php¦jar¦jpg¦js¦png¦swf¦wmv¦xsl)$)) /includes/request.inc.php [L]

The main problem was that the leading slash is stripped from URL-paths in .htaccess context, so your negative pattern would not match on "/forums/" -- you need to test for "forums/" instead. Other tweaks were needed to the filetype list. The [L] flag is added for efficiency.

Replace all instances of the broken pipe "¦" character with a solid pipe characters before use - posting on this board modifies them.

Jim

tekp

9:31 am on Oct 27, 2005 (gmt 0)

10+ Year Member



Ok, thanks :)

I did that, but now the forums are still giving me the same message...

Is it because they're trying to access a .php file? Could I exclude this file specifically in the .htaccess?

Also, what is the [L] 'flag' for? Just out of curiosity :P

jdMorgan

1:20 pm on Oct 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The key to finding the error is to look at both your php error log and the Apache server error log. If the problem still isn't clear, then you could clean up the relevant log entries (remove your domain name and specifically-identifiable info), and post them here.

You can exclude any URL-path-pattern you like from your rules. Rules can be constructed to specifically rewrite certain requests (inclusive), to rewrite all except certain URLs (exclusive), or a mixture of the two, whichever requires the least code, results in the simplest code, or results in code that is easier to maintain.

Be aware that a server-side include (via SSI or PHP, for example) does not access the included file by using HTTP requests; it simply reads the file using the local server filesystem. For this reason, it will not activate any HTTP-related functions, including .HTaccess or HTTPpd.conf -- Both of these start with "HT" because they relate to HTTP requests only. The local filesystem equivalent of an HTTP URL rewrite for use with server-side includes would be a 'symbolic link' -- See your *nix 'man' page for more info.

For more information on RewriteRule flags like [L], see the documentation cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim

tekp

5:38 pm on Oct 28, 2005 (gmt 0)

10+ Year Member



Thanks for the help.

I found my apache error log, but it just gives me the same message as IPB is giving me.

How do I find my PHP error log?

tekp

5:03 pm on Nov 3, 2005 (gmt 0)

10+ Year Member



(fixed now, thanks for the help :))