The .htaccess file is often a source of installation problems in relation with sNews.
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.
In some cases, you may find that you cannot get the .htaccess file working in your site. This is not an sNews issue or bug. The problem always exists on your host's server.
Apache's mod_rewrite module is not enabled.
Some hosts choose not to enable the mod_rewrite module within their Apache's server configuration file. Their reason may be security-related, in that they don't want any of their clients creating and using .htaccess files that could cause a security breakdown on their servers. If this is the case, you have no choice but to find another host who does have this module enabled so you can use your own .htaccess files without restriction.
Apache's mod_rewrite module is enabled but your site still doesn't work.
Some hosts will have the mod_rewrite module enabled but they also put hidden .htaccess files on every client's domain root directory and this file is 'write-protected' so you cannot overwrite it with your own .htaccess file. If you have uploaded your .htaccess file and noticed that it was visible on your domain's root directory right after uploading..., but seemed to disappear shortly afterwards..., then you have experienced this condition. A host will do this so they can have more control over security by using .htaccess files to keep you from using them. If your host will not remove their .htaccess file from your domain root then you have no choice but to find a better host.
Do not create Login Firewalls with CPanel. If you created a security login firewall on your domain using your domain's CPanel, that will cause the same problem. When you use this feature in your CPanel, you may not realize that it creates an .htaccess file in your root directory. It might be visible or it might be hidden. In all cases, files created this way are also write-protected so the login firewall cannot be eliminated by over-writing the file. The only way you can remove this file is by logging back into your CPanel, and de-activating it from there. Once this is done, you should be able to upload your .htaccess file.
Apache does not read .htaccess files by default even when the mod_rewrite module is installed.
When you have this error message when you click a link (except "Home"):
Not Found
The requested URL /***/snews/archives/ was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an Error Document to handle the request.
Apache/1.3.34 Server ad mydomain.com Post 80.
the problem probably lies in your webserver.
The reason for this is an option inside the default Apache installation.
If you have access to your Apache installation find the main configuration file httpd.conf; it's default location is /usr/local/apachex/conf/httpd.conf, but it may be moved using run-time or compile-time configuration. Find:
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
Change this to:
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
Then restart Apache.
Now if you have other websites that are on the same server, you can add 'per directory' options.
<Directory /var/www/html/mysite.com/snews_directory/>
Options FollowSymLinks
AllowOverride All
</Directory>
Restart Apache, and then you should be set.
The following, from hypergurl.com explains how .htaccess files work with the Apache server, and offers a solution for MS IIS servers.
The mod_rewrite module is a powerful scripting program that will translate URL's based on the patterns that you define. In layman's terms, this will allow you to feed the search engines URL's that appear to be static, but are actually dynamic.
As an example, consider the dynamic URL: http://www.yourWeb site.com/yourscript.php?id=123. This URL passes the variable called "id" to a script called yourscript.php. This script builds a dynamic page based on the product ID. How can we make this more search engine friendly?
With mod-rewrite, you can get the same result using the following URL: http://www.yourWeb site.com/productid123.htm. Notice how the "offending" question mark symbol has been removed from the URL. This second URL is much more search engine friendly. In addition, by using the mod-rewrite technique, it will function exactly the same as the first URL.
When mod-rewrite sees "productid123.htm", it knows to translate that into "yourscript.php?id=123". This translation takes place behind the scenes, so the URL in the browser's address bar will continue to display "productid123.htm" while your database program sees the URL it is expecting to see. It is important to understand that there is no re-direction taking place. It's simply a URL translation.
Is there an alternative to .htaccess for MS IIS servers? Yes..., there is. If your Web site runs on the Microsoft IIS server, you can obtain the same basic functionality described for Apache Web sites using a program called ISAPI rewrite. You can learn more about this program by visiting the website of the makers of this program.
Summary
Whether you are running a Microsoft or Apache server, test your changes by browsing and searching your site to see if it worked. Instead of having URL's containing question marks followed by the article or page ID, the ID should become part of the article or page name. Ampersands and commas should also be eliminated whenever possible. Hyphens, underscores, and periods should be fine.
Once you have verified that the change worked as expected, you must go into your site and change the URL's that point to each of your article or category pages so that they conform to the new format. This is critical since these are the links that the search engines will follow to find your product pages. If you leave them using the old syntax containing the troublesome symbols, then the search engines may still avoid spidering the links.
The website variable setting in snews.php is not correct. It may be missing a folder name or the forward slash is missing.
check to ensure your website URL is complete and the forward slash is in place at the end, like:
$db['website'] = 'http://www.your-domain.com/';
If your site is in a separate folder in the server's root directory, the URL needs the folder name in it too, like:
$db['website'] = 'http://your-domain.com/snews-folder-name/';
Your site's Home Page displays, but you get this message when you click on any link on this page.
The 'RewriteEngine On' line is missing or not enabled in your .htaccess file. Or, your .htaccess file is not active, present, or not working at all.
Check to see that your .htaccess file is located in your sNews site's root directory or folder, and that the 'RewriteEngine On' line is present and enabled:
OK:
RewriteEngine On
Not OK:
#RewriteEngine On -or- RewriteEngine Off
The variable settings in snews.php relating to the database are not correct.
Check to make sure the settings are exactly the same as you gave your database when you created it, e.g.:
$db['dbhost'] = 'localhost'; //MySQL Host
$db['dbname'] = 'snews15'; //Database Name
$db['dbuname'] = 'your_username'; //Database Username
$db['dbpass'] = 'your_passw'; //Database password
Either your database username or database password are incorrect.
Check to make sure the settings are exactly the same as you gave your database when you created it, e.g.:
$db['dbuname'] = 'your_username'; //Database Username
$db['dbpass'] = 'your_passw'; //Database password
The dbhost variable setting in snews.php is not correct.
Check the dbhost variable setting in snews.php; in most cases this should be 'localhost'
$db['dbhost'] = 'localhost'; //MySQL Host
<?php and that there is no space after the closing tag ?>.You get one, two, three or more warning lines in your Home page that all point to different line numbers in the snews.php file... e.g.:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:xamppxampphtdocssnews15snews.php on line 1684
This usually happens when a query within a particular function (in snews.php) cannot find the data it is looking for in the database. When you get several messages pointing to several lines within the snews.php file, that means there are several queries (possibly in several functions) that cannot find their data in the database.
The problem could be that
$db['prefix'] = 'snews_'; //Database prefix
Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Either the server is overloaded or there was an error in a CGI script.
If you think this is a server error, please contact the server administrator at .....
You better contact your hosting provider about this error. More information about this error may be available in the server error log.
You have added a string to the .htaccess file that interrupts the parsing sequence of the default sNews directives in the file. Or, something has changed that is affecting an existing directive.
Remove the offending string(s) or refresh the file with a new default copy of the .htaccess file.
If you have set everything up correctly and you have checked you can use your own .htaccess files on your server ànd have mod_rewrite enabled ànd you still get this error, then:
maybe the following section of the .htaccess file is not allowed on your web host server:
<IfModule mod_php4.c>
php_value session.use_trans_sid 0
</IfModule>
Try amending the top of the .htaccess file to this:
#<IfModule mod_php4.c>
# php_value session.use_trans_sid 0
#</IfModule>
Add a # to the first 3 lines of code.
Also, if you have just installed XAMPP make sure that the 'mod_rewrite' module is enabled in Apache's httpd.conf file. You can check to see if it is in the enabled modules list by running clicking the phpinfo() link in the bottom of the first section in the left side-bar after opening the main xampp page at http://localhost/xampp/index.php. By default, it is not enabled when XAMPP is first installed.
Some WYSIWYG editors like Dreamweaver, MS Word, Frontpage or similar editors sometimes inject unwanted (and invisible) code into your files. When you edited your snews.php with one of these, they might have corrupted your code.
Use a good text editor. Tips on good text editors for the big OS's can be found in the Tools area.
Cannot send session cache limiter - headers already sent (output started at /home/xxxxxx/public_html/test/inside_test.php:1) in /home/xxxxxx/public_html/test/inside_test.php on line 1
If your default charset (admin > settings > time and local settings) is UTF-8, then your index.file needs to be saved without BOM.
You probably have not used the <?php title(); ?>-function in your index.php file.
Change in your index.php
<title>Your Title</title>
in
<?php title(); ?>.
Beware that the title function (located in snews.php) prints a base href in your index.php. That base href is the site URL you have filled in in snews.php ($db['website'] = http://www.yoursite.ext/;), so you can use relative URL's, like "style.css" for your stylesheet.
In the stylesheet style.css which comes with the snews standard package you will find:
li {list-style-type: none} /* remove all the style elements from li */
This is to prevent bulleting when used in menus and the like. Now create a class to style your lists to use in articles, for instance:
/* make a class for li (just an example) */
.list li {
margin:.5em 0 0 0;
padding:0 0 0 15px;
list-style:none;
background: url(../images/list1.gif) no-repeat;
background-position: 0 .3em;
}
The default stylesheet style.css that comes with the standard sNews package has some styles defined, so you need to copy these styles into the CSS file of any template you port to run with sNews. These are the ones that style the administration panels. You can copy from here and paste into the bottom of your template's CSS file:
/* SNEWS */
fieldset { border: 1px solid #ccc; padding: 10px 8px; margin: 0 0 8px 0; background: #E6FFE4; color: #000; }
input { padding: 3px; margin: 0; }
textarea { width: 97%; height: 20em; padding: 3px;}
input.search { border: 1px solid #ccc; padding: 4px; width: 160px; }
.comment { background: #eee; color: #808080; padding: 10px; margin: 0 0 10px 0; border-top: 1px solid #ccc; }
.commentsbox { background: #E8FFD9; color: #808080; padding: 10px; margin: 0 0 10px 0; border-top: 1px solid #ccc; }.
Put this in your CSS stylesheet:
img {border:0; margin: 0; padding: 0;}
Then just make a class, for example:
.imgLeft {clear:left; float: left; margin: 5px 10px 5px 0;}
The html in your article will look like this:
<img src="img/your_image.gif" alt="your_alt" title="your_title" class="imgLeft" />.
In snews.php there is a function called tags (around line 250) which allows you to easily style your comments and infoline.
$tags['comments'] = '<div class="comment">,<p class="date">,name, on ,date,edit,</p>,<p>,comment,<p>,</div>';
For example we want the commentator's name in bold; then just change the tag to:
$tags['comments'] = '<div class="comment">,<p class="date">,<strong>,name,</strong>, on ,date,edit,</p>,<p>,comment,<p>,</div>';
Or insert a div or anything you like. But beware that you separate the individual elements by a comma, with no spaces, unless you actually want a space on that place.
You can find an excellent tutorial about this subject here.
Put this line in the head of your index.php:
<link rel="alternate" type="applications/rss+xml" title="RSS 2.0" href="rss/">
You can also add a "manual" link to your index.php, like this
<a href="rss/" title="RSS Feed" accesskey="r">RSS Feed</a> OR
<a href="rss/" title="RSS Feed" accesskey="r"><img src="rss-logo.gif" alt="RSS-link" title="Link to my RSS-feeds" /></a>
XML has 5 predefined Character Entities:
character: < encoding: < OR &#60;
character: > encoding: > OR &#62;
character: & encoding: & OR &#38;
character: ' encoding: ' OR &#39;
character: " encoding: &quot; OR &#34;
The rest of the special characters can be handled using either UTF-8 (optimal/best solution) or by using decimal or hexadecimal entities (make sure you convert Windows characters). The most made error is probably the one with the ampersand character ’&’ and the fact that people don't realize that it is important to use the proper encoding.
Just be aware that when using UTF-8, the source of snews.php needs to be saved as UTF-8 with no BOM, and all your HTML pages must be in the same character set. So make sure that:
You can validate your site at: http://feedvalidator.org/
You will find more about XML entities here and here.
Your RSS feed is probably not valid. You can validate your site at: http://feedvalidator.org/
Find in snews.php the function RSS() and search for the line:
$description = preg_replace("[[(.*?)]]", "", stripslashes(strip_tags($r['text'])));
and replace that with:
$description = preg_replace("[[(.*?)]]", "", stripslashes($r['text']));
then find a couple of lines below:
$item .= '<description>'.$description.'</description>';
and replace that line with:
$item .= '<description><![CDATA['.$description.']]></description>';
Make a page in sNews with the same name as the HTML-page and include it in the page as follows:
[include]http://yourdomain/path/to/htmlpage.html[/include]
You have to be sure that your upload directory is world wide writable, so if this is not the case, then chmod this folder to 777
For security reasons be carefull with this. There is a MOD to restrict upload of certain file types in the MOD's section.
To chmod a file:
There are two possible reasons.
Also when you use the command the title of your article will become a link to show the full article.
See the question: "I don't get the 'Read more ...' link"
In the administration panel under the label Site→Settings→Settings, you can change this in the input field 'Home SEF (used as link to Home):' to anything you want, e.g. to 'general'. In that case your link in the adresbar will look like this: http://your_domain.com/general/article.
Find the following line in the function categories() in snews.php
echo '<li><a'.$class.' href="'.db('website').'" title="'.l('home').'">'.l('home').'</a></li>';
and simply comment this entire line so it looks like:
// echo '<li><a'.$class.' href="'.db('website').'" title="'.l('home').'">'.l('home').'</a></li>';
sNews requires PHP, MySQL and mod rewrite. If your server meets those requirements, get started and learn how to install sNews on your website in 3 easy steps.
Browse through our help center and learn about template tags and how to simply create your own theme. Dig into sNews and customize it to behave the way you want.
sNews can be a simple blog tool and a full blown CMS. Customize it with addons, mods or play with different themes.
Talk about sNews on our Forum and share your expirience.