[solved] Pretty url - .htaccess file problem with Lunarpages
Posted: Thu Jul 24, 2008 11:40 am
Hello,
I am trying to set up a new cms ms site on a Lunarpages server. I've tried placing the following code into the .htaccess file, but every time, I get a 500 error on the whole site.
So, I emailed support and this is what they told me:
I am trying to set up a new cms ms site on a Lunarpages server. I've tried placing the following code into the .htaccess file, but every time, I get a 500 error on the whole site.
Code: Select all
RewriteEngine On
#option to remove directory listings in all folder (avoid publishing unwanted contents)
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.
# <Files "config.php">
# order allow,deny
# deny from all
# </Files>
# 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 "<__script__>"
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
#OR if the script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
#OR if any script is trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) [OR]
#OR if the URI contains UNION
RewriteCond %{QUERY_STRING} UNION [OR]
#OR if the URI contains a double slash
RewriteCond %{QUERY_STRING} // [OR]
#OR if the URI contains a *
RewriteCond %{QUERY_STRING} \*
#then deny the request (403)
RewriteRule ^.*$ - [F,L]
# End URL 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
# No sense advertising what we are running
ServerSignature Off
# HTTP response header forced to be "Server: Apache" only
# Sometimes this istruction must be saved inside httpd.conf or apache.conf or sites-enabled instead of .htaccess
ServerTokens Prod
I'm lost. So, how can I have mod_rewrite work for pretty urls then?Parts of the above are not allowed at Lunarpages.
The only rewire above that I would suggest keeping is the entry to deny access to your config file. The other entries are usually covered by keeping your script up to date.