[SOLVED] Suggested URL filtering doesnt work

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
User avatar
thomahawk
Power Poster
Power Poster
Posts: 312
Joined: Fri Jul 25, 2008 10:13 am
Location: Zug, Switzerland

[SOLVED] Suggested URL filtering doesnt work

Post 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
Last edited by thomahawk on Wed May 06, 2009 6:27 am, edited 1 time in total.
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm
Location: MI

Re: Suggested URL filtering doesnt work

Post by Jeff »

How about pasting the contents of your .htaccess file here, incase you copied incorrectly.
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm
Location: Fairless Hills, Pa USA

Re: Suggested URL filtering doesnt work

Post 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.
User avatar
thomahawk
Power Poster
Power Poster
Posts: 312
Joined: Fri Jul 25, 2008 10:13 am
Location: Zug, Switzerland

Re: Suggested URL filtering doesnt work

Post 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
User avatar
thomahawk
Power Poster
Power Poster
Posts: 312
Joined: Fri Jul 25, 2008 10:13 am
Location: Zug, Switzerland

Re: Suggested URL filtering doesnt work

Post 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
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm
Location: MI

Re: Suggested URL filtering doesnt work

Post 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
User avatar
thomahawk
Power Poster
Power Poster
Posts: 312
Joined: Fri Jul 25, 2008 10:13 am
Location: Zug, Switzerland

[SOLVED] Suggested URL filtering doesnt work

Post 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
Pierre M.

Re: Suggested URL filtering doesnt work

Post 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.
Post Reply

Return to “Developers Discussion”