LG .htaccess Generator v1.0.0 Easily remove index.php from your ExpressionEngine URLs
Download LG .htaccess Generator v1.0.0 Table of contentsFeatures
LG .htaccess Generator Multi-Site Manager compatible ExpressionEngine extension that automatically generates and updates your sites .htaccess file everytime an entry, template group or template is created or modified.
Using special {ee:} tags LG .htaccess Generator allows you to easily remove your sites index.php file using the "Include List Method".
Screenshots
Requirements
LG .htaccess Generator requires ExpressionEngine 1.6+ and an existing .htacess file with write permissions (the file can be blank). Update notifications will only be displayed if LG Addon Updater is installed.
Installation
The LG .htaccess Generator extension package contains an extension and a language file. To install LG .htaccess Generator follow the instructions below:
- Download the latest version of LG .htaccess Generator
- Extract the .zip file to your desktop
- Copy extensions/ext.lg_htaccess_generator_ext.php file to your /system/extensions directory
- Copy the language/english/lang.lg_htaccess_generator_ext.php file to your /system/languages/english directory
- Open the Extension Manager
- Enable Extensions if not already enabled
- Enable the extension
- Configure the extension settings
Configuration
LG .htaccess Generaot has the following extension settings which must be entered separately for each Multi-Site Manager site:
Enable
Yes | No
Enable LG .htaccess Generator for this site?
The server directory where your .htaccess will be generated
/usr/loca/var/www/html/my-site/
LG .htaccess Generator will use this directory to look for an existing .htaccess file and add the custom rewrite rules. If the file contains existing rules these will not be modified.
.htaccess Rules
# secure .htaccess file
<Files .htaccess>
order allow,deny
deny from all
</Files>
# Dont list files in index pages
IndexIgnore *
# EE 404 page for missing pages
ErrorDocument 404 /index.php?/{ee:404}
# Simple 404 for missing files
<FilesMatch "(\.jpe?g|gif|png|bmp)$">
ErrorDocument 404 "File Not Found"
</FilesMatch>
RewriteEngine On
RewriteBase /
# Remove the www
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Rewrite homepage urls that have the Google Analyticis query string
# CampaignMonitor adds the query string in their emails
# "site" is the template group
# "index" is the template name
# The template group and template should point to your sites index
RewriteCond %{QUERY_STRING} ^utm_medium
RewriteCond %{REQUEST_URI} ^/$ [NC]
RewriteRule (.*) /index.php?/pages/index/&%{QUERY_STRING} [L]
# Add a trailing slash to paths without an extension
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule ^(.*)$ $1/ [L,R=301]
# Remove index.php
# Uses the "include method"
# http://expressionengine.com/wiki/Remove_index.php_From_URLs/#Include_List_Method
RewriteCond %{QUERY_STRING} !^(ACT=.*)$ [NC]
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5})$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^/({ee:template_groups}|members|P[0-9]{2,8}) [NC]
RewriteRule (.*) /index.php?/site/index/&%{QUERY_STRING}
If you are using the Pages or Structure module make sure you add: {ee:pages}| into the include string after {ee:template_groups}.
The .htaccess rules will be added to your .htaccess file after the following special tags are replaced:
{ee:template_groups}will be replaced with a pipe delimited list of this sites template groups.{ee:pages}will be replaced with a pipe delimited list of this sites page urls.{ee:404}will be replaced with the sites 404 path ie: site/404.
For more information about the default .htaccess rules visit my official launch post on newism.com.au.
Read more about the "Include List Method" of removing your sites index.php on the ExpressionEngine Wiki.
Check for updates?
LG .htaccess Generator can call home and check for recent extension updates. This feature requires LG Addon Updater.
Usage
LG .htaccess Generator has no special usage requirements. Everytime a template group is created or modified or a weblog entry is created or modified LG .htaccess Generator will kick in an update the .htaccess file. A status update will be presented to the editor.
Change Log
1.0.0
- Initial Release w/ documentation
License
LG .htacess Generator is a free commercial product and therefore its usage is subject to the commercial license agreement.
Contributors
Page created on: Sep 08, 2008
Last updated on: Jun 24, 2009


Enjoy LG .htaccess Generator v1.0.0? Bookmark and share it with others.