Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: .htaccess file  (Read 977 times)

Spadge

  • Newbie
  • *
  • Karma: 0
  • Posts: 4
.htaccess file
« on: November 01, 2010, 01:09:12 pm »

Hi I wonder if anyone can just clarify something for a newbie?

The FAQ section states that the .htaccess file must be in your site's root directory, as I have installed sNews in /public_html/snews17 I assume that the .htaccess file should be in /public_html however this causes the main site to crash even if I append the existing .htaccess file contents (AddHandler server-parsed .html)

I have confirmed with my host that mod_rewrite module is enabled and even tried placing my .htaccess in the snews17 folder but all to no avail, I just get a 500 Internal Server Error

Code: [Select]
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, a@b.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

The installation is at http://studiojimmys.com/snews17/

Thanks in anticipation

Chris

Logged

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: .htaccess file
« Reply #1 on: November 01, 2010, 01:53:49 pm »

Hi Chris,

The .htaccess file must be placed in the same folder as your snews.php and index.php files. I haven't looked at the FAQ section in a while but the wording suggests it assumes that sNews is installed on the root. Which isn't always the case. The simple way of installing sNews is to simply upload the entire folder to your domain, that way you'll get all files in the correct place.

However, when installing in a subfolder, you need to make sure that the RewriteBse line in your .htaccess file properly reflects the pah to your sNews installation. In other words, in your case, remove the hash tag at the beginning of the line and make sure the folder name is /snews17. Like so:

Code: [Select]
RewriteBase /snews17
Hope that helps,
Fred
Logged

Spadge

  • Newbie
  • *
  • Karma: 0
  • Posts: 4
Re: .htaccess file
« Reply #2 on: November 01, 2010, 02:38:19 pm »

Thanks for clarifying that Fred That is just what I have done and the .htaccess file looks like this now

Code: [Select]
<IfModule mod_php4.c>
    php_value session.use_trans_sid 0
</IfModule>
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>
RewriteEngine On
RewriteBase /snews17
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*) $1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?category=$1 [L]

But it still gives me the 500 Internal Server Error message

I have asked my host to double check I have the correct database information too and sent them a copy of .htaccess so will report back if they find anything wrong

Thanks again

Chris
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
Re: .htaccess file
« Reply #3 on: November 01, 2010, 03:03:08 pm »

Hi Chris,
The .htaccess file must be placed in the same folder as your snews.php and index.php files. I haven't looked at the FAQ section in a while but the wording suggests it assumes that sNews is installed on the root. Which isn't always the case.

As a point of clarification, the Readme.htm file included in the Official Download package presents accurate directions on how to place and use the .htaccess file as follows:

Important! sNews makes use of the Apache module mod_rewrite and the system file .htaccess to create the Search Engine Friendly (SEF) links that are essential to the CMS. Using SEF or pretty links makes your site much more search engine friendly and gives it better rankings on Google and other popular search engines. If you install the sNews files in a subfolder on your domain root (i.e. http://mydomain.com/subfolder/), you must edit the included .htaccess file to match the path to your installation. On a web server, use your FTP client to locate the .htaccess file in your sNews installation folder (you will need to enable "show hidden files" or similar feature in the client).

It is useful to keep that Readme.htm file as a handy reference tohelp you get back on track when you experience any installation issues.  8)
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: .htaccess file
« Reply #4 on: November 01, 2010, 03:34:20 pm »

@Keyrocks: The problem with the wording in the FAQ is that it only covers the root installation scenario:
Quote
sNews uses the .htaccess file to execute certain behaviours through Apache. To do this the .htaccess file must be in your site's root directory and it must be named exactly as it is: .htaccess. On top of that your site must be on a host server that has all the right conditions present to function properly.
Might be a good idea to look over the site documentation?

@Chris - check with your host that the rewrite.mod is enabled, and also that they allow you to use your own .htaccess files - not all hosts enable this by default. Your host does use Apache servers, yes?
Logged

Spadge

  • Newbie
  • *
  • Karma: 0
  • Posts: 4
Re: .htaccess file
« Reply #5 on: November 01, 2010, 03:54:08 pm »

Quote
@Chris - check with your host that the rewrite.mod is enabled,
Yes, as mentioned in my original post.
 
Quote
and also that they allow you to use your own .htaccess files - not all hosts enable this by default.
Yes they do.
 
Quote
Your host does use Apache servers, yes?
In deed they do  :)


Logged

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: .htaccess file
« Reply #6 on: November 01, 2010, 05:20:00 pm »

okay... have you tried commenting out the first few lines in the .htaccess file?

E.g: change
Code: [Select]
<IfModule mod_php4.c>
    php_value session.use_trans_sid 0
</IfModule>
<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

to:
Code: [Select]
#<IfModule mod_php4.c>
#    php_value session.use_trans_sid 0
#</IfModule>
#<IfModule mod_security.c>
#SecFilterEngine Off
#SecFilterScanPOST Off
#</IfModule>

RewriteEngine On
etc
Logged

Spadge

  • Newbie
  • *
  • Karma: 0
  • Posts: 4
Re: .htaccess file
« Reply #7 on: November 01, 2010, 05:47:31 pm »

Yay! Success!!!

Thanks Fred you're a star!!!
Logged