We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

LG .htaccess Generator

Development and Programming

Leevi Graham's avatar
Leevi Graham
1,143 posts
16 years ago
Leevi Graham's avatar Leevi Graham

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.

       
Jason McCallister's avatar
Jason McCallister
255 posts
16 years ago
Jason McCallister's avatar Jason McCallister

BRILLIANT! Going to install tonight!

       
Jason McCallister's avatar
Jason McCallister
255 posts
16 years ago
Jason McCallister's avatar Jason McCallister

BTW, Quick turn around from idea to production!

       
Leevi Graham's avatar
Leevi Graham
1,143 posts
16 years ago
Leevi Graham's avatar Leevi Graham

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

       
Jason McCallister's avatar
Jason McCallister
255 posts
16 years ago
Jason McCallister's avatar Jason McCallister

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?

       
Leevi Graham's avatar
Leevi Graham
1,143 posts
16 years ago
Leevi Graham's avatar Leevi Graham

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

       
Jason McCallister's avatar
Jason McCallister
255 posts
16 years ago
Jason McCallister's avatar Jason McCallister

No, I only have the CP directory.

       
Leevi Graham's avatar
Leevi Graham
1,143 posts
16 years ago
Leevi Graham's avatar Leevi Graham

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

       
Jason McCallister's avatar
Jason McCallister
255 posts
16 years ago
Jason McCallister's avatar Jason McCallister

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)$">
       
Leevi Graham's avatar
Leevi Graham
1,143 posts
16 years ago
Leevi Graham's avatar Leevi Graham

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?

       
Jason McCallister's avatar
Jason McCallister
255 posts
16 years ago
Jason McCallister's avatar Jason McCallister

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.

       
Jason McCallister's avatar
Jason McCallister
255 posts
16 years ago
Jason McCallister's avatar Jason McCallister

Removed directory… still having the same problem…

       
Leevi Graham's avatar
Leevi Graham
1,143 posts
16 years ago
Leevi Graham's avatar Leevi Graham

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

       
timkelty's avatar
timkelty
177 posts
16 years ago
timkelty's avatar timkelty

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
       
Leevi Graham's avatar
Leevi Graham
1,143 posts
16 years ago
Leevi Graham's avatar Leevi Graham

My bad … accidentally uploaded the dev version… grab the download again 😊

       
1 2 3 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.