Page 1 of 1

[SOLVED] Suggested URL filtering doesnt work

Posted: Fri May 01, 2009 8:31 am
by thomahawk
Hello all! I used the suggested code from http://wiki.cmsmadesimple.org/index.php ... l_Settings for URL filtering in an .htaccess file. I copy pasted the suggested code. After installing it on the server, my cmsms site didn't come up anymore. What is wrong with this code?

Thomas

Re: Suggested URL filtering doesnt work

Posted: Sat May 02, 2009 8:16 am
by Jeff
How about pasting the contents of your .htaccess file here, incase you copied incorrectly.

Re: Suggested URL filtering doesnt work

Posted: Sun May 03, 2009 12:11 am
by Ted
Certain options in .htaccess could be disabled.  If you still put them in, you generate a 500 error.  Those errors will show up in your site's error log, if you have access.  It could just be one line that's causing the issue as well.  You might not be able to use Options, and that line is causing the error.  The error log knows all...  find it and take a look.

Re: Suggested URL filtering doesnt work

Posted: Mon May 04, 2009 3:59 pm
by thomahawk
Ok thanks for the suggestions.

The complete contect of htaccess is


# BEGIN Optional settings

# Turns off directory browsing
# not absolutely essential, but keeps people from snooping around without
# needing empty index.html files everywhere
Options -Indexes

# Deny access to config.php
# This can be useful if php ever breaks or dies
# Use with caution, this may break other functions of CMSms that use a config.php
# file.  This may also break other programs you have running under your CMSms
# install that use config.php.  You may need to add another .htaccess file to those
# directories to specifically allow config.php.

order allow,deny
deny from all


# Sets your 403 error document
# not absolutely essential to have,
# or you may already have error pages defined elsewhere
ErrorDocument 403 /forbidden403.shtml

# No sense advertising what we are running
ServerSignature Off

# END Optional Settings

# BEGIN CMSMS and Rewrite Rules
# Make sure you have Options FollowSymLinks
# and Allow on

RewriteEngine On

# Might be needed in a subdirectory
#RewriteBase /

# URL Filtering helps stop some hack attempts
#IF the URI contains a "http:"
RewriteCond %{QUERY_STRING} http\: [OR]
#OR if the URI contains a "["
RewriteCond %{QUERY_STRING} \[ [OR]
#OR if the URI contains a "]"
RewriteCond %{QUERY_STRING} \] [OR]
#OR if the URI contains a ""
RewriteCond %{QUERY_STRING} (\|%3E) [NC,OR]
#OR script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
#OR any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule ^.*$ - [F,L]
# END Filtering

# CMSMS Rewriting
# Set assume mod_rewrite to true in config.php and clear CMSMS cache
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
# END CMSMS

# END Rewrite rules

Re: Suggested URL filtering doesnt work

Posted: Mon May 04, 2009 4:07 pm
by thomahawk
Now, as Ted suggested: The error log says:
RewriteCond: bad argument line '%{REQUEST_FILENAME}\xc2\xa0!-f'\n

I could simply delete the "# CMSMS Rewriting" part, but then, what happens?

Thomas

Re: Suggested URL filtering doesnt work

Posted: Mon May 04, 2009 6:45 pm
by Jeff
With the problem showing this line:
>RewriteCond: bad argument line '%{REQUEST_FILENAME}\xc2\xa0!-f'\n

Some invalid character got inserted when you posted. Try retyping this line:
RewriteCond %{REQUEST_FILENAME} !-f

[SOLVED] Suggested URL filtering doesnt work

Posted: Tue May 05, 2009 7:53 am
by thomahawk
Well, I couldn't see anything there then an empty space, even in pure text without format. But I did rewrite it as you suggested and it seems to be working now.... very strange, but thanks for the help!

Thomas

Re: Suggested URL filtering doesnt work

Posted: Tue May 05, 2009 2:45 pm
by Pierre M.
Maybe it was a non breaking space or a tab or another invisible special typo. It is often worth the pain to erase all spacing and restrike the true spacebar where needed.

Have fun with CMSms

Pierre M.