::How to:: Use .htaccess file with Pligg

Register an Account
Pligg Chat Room
Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-25-2007, 10:16 AM
kbeeveer46's Avatar
Pligg Developer/Admin
Pligg Version: 0
Pligg Template: none
 
Join Date: Jun 2006
Location: Muncie, Indiana
Posts: 3,215
This is just going to be a small tutorial on how to use an .htaccess file with Pligg and what it can do for your Pligg site.

1. There is no support for .htaccess on windows servers e.g. IIS. This has to do with how Windows servers work and is not an issue with Pligg. This tutorial will be biased towards Apache since that's what most people use.

2. Make sure that mod_rewrite is enabled in Apache. If you have access to your Apache httpd.conf file search for LoadModule rewrite_module modules/mod_rewrite.so and make sure there isn't a # in front of it. If there is, remove it and save the file. You will need to restart Apache for this to take effect. If you follow this tutorial and get an error that says "Internal Server Error" or something similar that usually means that mod_rewrite is not enabled.

3. Next rename your htaccess.default file to .htaccess (Note the period in front of it)

4. Now I am going to go through the important things in the .htaccess file that you need to know about

a. Pligg uses two methods of gzip compression to decrease page load times. I will talk about the first method which you can enable in your .htaccess file
Code:
## To enable Gzip and decrease the load times of your Pligg site
## change /home/path/to to your absolute server path and remove the two # from both lines
## php_value auto_prepend_file /home/path/to/begin_gzip.php
## php_value auto_append_file /home/path/to/end_gzip.php
You can easily enable this feature by following the directions that you see above. Uncomment the two lines by removing both ## and replace the path with your server path.

b.
Code:
RewriteBase /
This tells the .htaccess file where your Pligg is installed. If it's installed in the root of your server then you don't need to change this line. If you installed Pligg in a subfolder called pligg then you will want to change it to
Code:
RewriteBase /pligg
c.
Code:
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^\/?(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
This section of code will automatically put www. in front of your URL when someone visits your site. Most of the time this will fix the problem people run in to when voting won't work unless www. is used in the URL. This code should be removed if you do no want www. automatically appended to the URL.

d.
Code:
RewriteRule ^(all|pligg)/([a-zA-Z0-9-]+)/?$ story.php?title=$2 [L]
RewriteRule ^(all|pligg)/?$ ?category=$1 [L]
You will notice these two lines in your .htaccess file. These are very important once you start adding categories to your Pligg site. Once you are in the category manager you will notice that it automatically produces the code you need for your categories to work with the .htaccess file. You will copy that code over the code above.

The rest of the htaccess file is for the use of URL method 2 or "clean" urls. For example:

www.mydomain.com/search.php?search=technology would change to www.mydomain.com/search/technology

Pligg beta 9.0 (9.1 should be working) has quite a few bugs when it comes to using "clean" urls but they have since been fixed and if you would like to have this working on your site then let us know and we can show you how to get the latest SVN code from Sourceforge. Here is a quick tutorial on how to get the latest SVN code: http://www.pligg.com/forum/showpost....92&postcount=2

Here is the article on wikipedia about htaccess http://en.wikipedia.org/wiki/Htaccess

If you have any good tips to add to this tutorial let me know.

Last edited by kbeeveer46; 03-01-2007 at 11:44 AM.
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Index.php won't open to install nigelnix Questions and Comments 5 02-18-2010 04:59 PM
IIS 6.0 W2K3 & Pligg 9.9.5 - Install (Step by Step) yfki Questions and Comments 2 01-12-2009 02:01 AM
pligg in a subdirectory with a php file at the host root nationalchamps Questions and Comments 2 08-19-2008 01:29 PM
Pligg integration with SMF Forum autoinc Questions and Comments 64 05-19-2008 02:22 AM
Internal Server Error wagthis Questions and Comments 12 01-16-2007 05:20 PM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development