1 of 10
1
LG .htaccess Generator
Posted: 07 September 2008 11:36 PM   [ Ignore ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1306
Joined  01-24-2006

Hey guys,

Heres another ExpressionEngine extension to add to my list of EE Addons. Introducing LG .htaccess Generator.

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”.

Check out the documentation which is now available on my site!

Enjoy, feedback is appreciated.

 Signature 

Newism - Newcastle Web Design & Development


NSM Publish Plus - Collaborative workflow and live entry previews
LG Better Meta - SEO Meta & XML Sitemap Generator
LG Polls
LG .htaccess Generator
20+ EE addons

Profile
 
 
Posted: 07 September 2008 11:53 PM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  358
Joined  05-05-2008

BRILLIANT!  Going to install tonight!

 Signature 

Invoked Projects | ExpressionEngine & Best Security Practices | Panic Coda EE Clips

ideas are sparked by ramblings of confused personage

Profile
 
 
Posted: 07 September 2008 11:54 PM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  358
Joined  05-05-2008

BTW, Quick turn around from idea to production!

 Signature 

Invoked Projects | ExpressionEngine & Best Security Practices | Panic Coda EE Clips

ideas are sparked by ramblings of confused personage

Profile
 
 
Posted: 08 September 2008 12:07 AM   [ Ignore ]   [ # 3 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1306
Joined  01-24-2006

With docs and testing it was a couple of days on and off. Another EE itch scratched!

 Signature 

Newism - Newcastle Web Design & Development


NSM Publish Plus - Collaborative workflow and live entry previews
LG Better Meta - SEO Meta & XML Sitemap Generator
LG Polls
LG .htaccess Generator
20+ EE addons

Profile
 
 
Posted: 08 September 2008 01:07 AM   [ Ignore ]   [ # 4 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  358
Joined  05-05-2008

I have noticed one problem… When I go to my /system to get my control panel… My default site shows up. However when I go to /system/index.php it shows up. Maybe adding an exclusion by referencing the $cp_url & $system_path?

 Signature 

Invoked Projects | ExpressionEngine & Best Security Practices | Panic Coda EE Clips

ideas are sparked by ramblings of confused personage

Profile
 
 
Posted: 08 September 2008 01:39 AM   [ Ignore ]   [ # 5 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1306
Joined  01-24-2006

Do you have a template group named the same as your cp directory?

 Signature 

Newism - Newcastle Web Design & Development


NSM Publish Plus - Collaborative workflow and live entry previews
LG Better Meta - SEO Meta & XML Sitemap Generator
LG Polls
LG .htaccess Generator
20+ EE addons

Profile
 
 
Posted: 08 September 2008 01:58 AM   [ Ignore ]   [ # 6 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  358
Joined  05-05-2008

No, I only have the CP directory.

 Signature 

Invoked Projects | ExpressionEngine & Best Security Practices | Panic Coda EE Clips

ideas are sparked by ramblings of confused personage

Profile
 
 
Posted: 08 September 2008 02:15 AM   [ Ignore ]   [ # 7 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1306
Joined  01-24-2006

Hmmm… can you post your generated .htaccess file in a pastie so we can have a look at it? http://pastie.org/

 Signature 

Newism - Newcastle Web Design & Development


NSM Publish Plus - Collaborative workflow and live entry previews
LG Better Meta - SEO Meta & XML Sitemap Generator
LG Polls
LG .htaccess Generator
20+ EE addons

Profile
 
 
Posted: 08 September 2008 02:20 AM   [ Ignore ]   [ # 8 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  358
Joined  05-05-2008

Here it is, I am on MediaTemple in case you’re wondering.

Why Pastie BTW?

UPDATED: Added the remainder of the .htaccess

AddHandler php5-script .php

# -- LG .htaccess Generator Start --

# .htaccess generated by LG .htaccess Generator v1.0.0
# http://leevigraham.com/cms-customisation/expressionengine/addon/lg-htaccess-generator/

# 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?/

# 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]

# 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]

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 %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5})$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond
%{REQUEST_URI} ^/(site|about|global|about|contact|registration|team|sponsors|donors|news|events|blog|contact|events|party|monkey|generator|global|d$
RewriteRule ^(.*)$ /index.php?/$1 [L]

# Remove IE image toolbar
<FilesMatch "\.(html|htm|php)$">
 Signature 

Invoked Projects | ExpressionEngine & Best Security Practices | Panic Coda EE Clips

ideas are sparked by ramblings of confused personage

Profile
 
 
Posted: 08 September 2008 02:45 AM   [ Ignore ]   [ # 9 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1306
Joined  01-24-2006

First thing I noticed is that the {ee:404} tag is not being rendered. I’m guessing thats because you don’t have a 404 page setup in EE.

Secondd thing is that it seems you have only pasted half your .htaccess. Wheres the “Include Method” part?

 Signature 

Newism - Newcastle Web Design & Development


NSM Publish Plus - Collaborative workflow and live entry previews
LG Better Meta - SEO Meta & XML Sitemap Generator
LG Polls
LG .htaccess Generator
20+ EE addons

Profile
 
 
Posted: 08 September 2008 03:06 AM   [ Ignore ]   [ # 10 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  358
Joined  05-05-2008

I figured it out. I forgot that the extension will create the .htaccess for all MSM domains. I have a directory called admin on another domain. The reason its there is for my clients to go to /admin instead of /admin.php. Any ideas to work around this? I’m thinking that I just need to delete the other domains until they are actually using them.

This is the setup i used: http://expressionengine.com/docs/installation/masked_cp_access.html

I will have to create the 404 Page soon.

 Signature 

Invoked Projects | ExpressionEngine & Best Security Practices | Panic Coda EE Clips

ideas are sparked by ramblings of confused personage

Profile
 
 
Posted: 08 September 2008 03:20 AM   [ Ignore ]   [ # 11 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  358
Joined  05-05-2008

Removed directory… still having the same problem…

 Signature 

Invoked Projects | ExpressionEngine & Best Security Practices | Panic Coda EE Clips

ideas are sparked by ramblings of confused personage

Profile
 
 
Posted: 08 September 2008 04:13 AM   [ Ignore ]   [ # 12 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1306
Joined  01-24-2006

The extension has per site settings so you can turn off .htaccess generation for each individual site.

You might also need to add /admin to the list of included template groups manually

 Signature 

Newism - Newcastle Web Design & Development


NSM Publish Plus - Collaborative workflow and live entry previews
LG Better Meta - SEO Meta & XML Sitemap Generator
LG Polls
LG .htaccess Generator
20+ EE addons

Profile
 
 
Posted: 08 September 2008 06:33 AM   [ Ignore ]   [ # 13 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  252
Joined  12-13-2007

Hmmm… When I hit Submit and Generate I get:

MySQL ERROR:

Error Number: 1146

Description: Table ‘ee_default_install.exp_template_groups WHERE site_id = 1’ doesn’t exist

Query: SELECT group_name FROM `exp_template_groups WHERE site_id = 1

 Signature 

Fusionary | Geniuscar

Profile
 
 
Posted: 08 September 2008 06:54 AM   [ Ignore ]   [ # 14 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1306
Joined  01-24-2006

My bad ... accidentally uploaded the dev version… grab the download again smile

 Signature 

Newism - Newcastle Web Design & Development


NSM Publish Plus - Collaborative workflow and live entry previews
LG Better Meta - SEO Meta & XML Sitemap Generator
LG Polls
LG .htaccess Generator
20+ EE addons

Profile
 
 
Posted: 08 September 2008 07:03 AM   [ Ignore ]   [ # 15 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  252
Joined  12-13-2007

Workin’ great now, love it love it love it

 Signature 

Fusionary | Geniuscar

Profile
 
 
Posted: 08 September 2008 07:33 AM   [ Ignore ]   [ # 16 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1306
Joined  01-24-2006

Yay, sorry of the mix up

 Signature 

Newism - Newcastle Web Design & Development


NSM Publish Plus - Collaborative workflow and live entry previews
LG Better Meta - SEO Meta & XML Sitemap Generator
LG Polls
LG .htaccess Generator
20+ EE addons

Profile
 
 
Posted: 08 September 2008 08:20 PM   [ Ignore ]   [ # 17 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  252
Joined  12-13-2007

When I test this locally, it works great, using the htaccess just as its included in the extension.

However, when I deploy to my development server I have a couple issues.
If I leave in the “Remove IE image toolbar” lines, I immediately get a server error.  Commenting them out fixes it.

Also, my system directory isn’t available. mysite.com/systemfolder just goes to the homepage.  Again, testing the same thing locally (MAMP) works fine.

I tried a variety of changes but could not get the include method to work on the server.  As soon as I switched to the exclude method as I was doing before, my system dir is available again.

Any ideas?

 Signature 

Fusionary | Geniuscar

Profile
 
 
Posted: 09 September 2008 12:40 AM   [ Ignore ]   [ # 18 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1306
Joined  01-24-2006

I just uploaded a tweak to the extension. The extension will only regenerate the .htaccess if the entry is a page or the template group has been modified which means you won’t see the success notification all the time.

Cheers

 Signature 

Newism - Newcastle Web Design & Development


NSM Publish Plus - Collaborative workflow and live entry previews
LG Better Meta - SEO Meta & XML Sitemap Generator
LG Polls
LG .htaccess Generator
20+ EE addons

Profile
 
 
   
1 of 10
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1743, on December 02, 2009 03:47 PM
Total Registered Members: 120489 Total Logged-in Users: 56
Total Topics: 126559 Total Anonymous Users: 24
Total Replies: 665417 Total Guests: 282
Total Posts: 791976    
Members ( View Memberlist )