[solved] Pretty url - .htaccess file problem with Lunarpages

Help with getting the CMS CORE package up and running. This does not include 3rd party modules, PHP scripts, anything downloaded via module manager or from any external source.
Locked
User avatar
SusanN
Forum Members
Forum Members
Posts: 192
Joined: Wed Jun 13, 2007 5:57 pm

[solved] Pretty url - .htaccess file problem with Lunarpages

Post by SusanN »

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.

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
So, I emailed support and this is what they told me:
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.
I'm lost.  So, how can I have mod_rewrite work for pretty urls then?
Last edited by SusanN on Thu Jul 24, 2008 11:56 am, edited 1 time in total.
Ziggywigged
Power Poster
Power Poster
Posts: 424
Joined: Sat Feb 02, 2008 12:42 am

Re: Pretty url - .htaccess file problem with Lunarpages

Post by Ziggywigged »

How are you uploading the .htaccess file?

This happens to me occasionally with some hosts if I upload the file via a FTP program like Dreamweaver. Try adding/editing the .htaccess file via your filemanager in cpanel (I believe that's what Lunar uses) and see if that helps.
Take a penny, leave a penny.
User avatar
SusanN
Forum Members
Forum Members
Posts: 192
Joined: Wed Jun 13, 2007 5:57 pm

Re: Pretty url - .htaccess file problem with Lunarpages

Post by SusanN »

Well, I'm using Smart FTP to upload it.  But when that wasn't working, I went into cpanel and tried to edit the file in there.  Still nothing.
User avatar
SusanN
Forum Members
Forum Members
Posts: 192
Joined: Wed Jun 13, 2007 5:57 pm

Re: Pretty url - .htaccess file problem with Lunarpages

Post by SusanN »

Okay, I just solved this.  I thought I'd try to remove stuff that looked like it wasn't part of the mod_rewrite rules.  So, I started at the bottom.  I removed this:

Code: Select all

# 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
And now it's working. 

Thanks for your reply, mikeim.
Ziggywigged
Power Poster
Power Poster
Posts: 424
Joined: Sat Feb 02, 2008 12:42 am

Re: Pretty url - .htaccess file problem with Lunarpages

Post by Ziggywigged »

Try removing all except: RewriteEngine On
and see if that works.
If so, then start adding more code section by section until it breaks or all works.

Also, did you enable pretty urls in your config.php file?
Take a penny, leave a penny.
User avatar
SusanN
Forum Members
Forum Members
Posts: 192
Joined: Wed Jun 13, 2007 5:57 pm

Re: [solved] Pretty url - .htaccess file problem with Lunarpages

Post by SusanN »

Seems like we were having similar ideas.  :)  I got it working (see my post right above yours).  Thanks!
Ziggywigged
Power Poster
Power Poster
Posts: 424
Joined: Sat Feb 02, 2008 12:42 am

Re: [solved] Pretty url - .htaccess file problem with Lunarpages

Post by Ziggywigged »

Ok, good. Scratch that post then. ;D

You might want to uncomment (remove # before each line) the section for your protecting your config file:

Code: Select all

# <Files "config.php">
#     order allow,deny
#    deny from all
# </Files>
Take a penny, leave a penny.
User avatar
SusanN
Forum Members
Forum Members
Posts: 192
Joined: Wed Jun 13, 2007 5:57 pm

Re: [solved] Pretty url - .htaccess file problem with Lunarpages

Post by SusanN »

Thanks for the tip! 
Locked

Return to “[locked] Installation, Setup and Upgrade”