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

Also try removing the rules you don’t need right now…. like add trailing slash.

       
Ryan M.'s avatar
Ryan M.
1,511 posts
16 years ago
Ryan M.'s avatar Ryan M.

Apache Version Apache/2.0.63 (Unix)

  1. Removed the systems folder names from the list
  2. Removed the {ee:pages} variable entirely, as I’m not using the Pages module.

And…voila. I wonder if it was the double pipe, because I didn’t have any pages being put in there via the variable? Yep…I threw the pipe back in there without the variable, and the double pipe seems to have been the cause of my trouble. Cool, cool, cool…this is a great extension!

The only thing that doesn’t “work” now is the www removal rule. Am I misunderstanding how that works? If I type in “www.site.com” the first page I visit should go to “site.com”?

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

Ok so double pipe is the issue…

I guess the next thing that is needed is a {if pages}|{ee:pages}{/if} tag pair or something like that.

Glad its working. I’ll check the remove www. rule to figure out whats goign on when I get time.

Glad you like it!

       
Ryan M.'s avatar
Ryan M.
1,511 posts
16 years ago
Ryan M.'s avatar Ryan M.

You may not need to spend time on the {if pages} if the variable can just be easily removed like I did.

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

My only concern would be that a user would add a page (after the variable has been removed) and the site would break.

       
Jean-Francois Turcot's avatar
Jean-Francois Turcot
3 posts
16 years ago
Jean-Francois Turcot's avatar Jean-Francois Turcot

This extension is wonderful but I have a problem with the removal of the www. with your method.

This is what was originally generated by your extension in my .htaccess:

RewriteCond %{HTTP_HOST} ^(www\.$) [NC]
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

I am on a MAMP server and it was not working at all, it always kept the www. in front of the url.

Then after reading the http://no-www.org/ website, I tried their way of removing the www. and this time it worked perfectly. This is what I am using now:

RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

Is one way better than the other? I am not really an expert with .htaccess files but this modification finally made it work.

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

Ahh of course…. that makes sense. I’ll update the default installation.

The (.)+ in

RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]

matches one or more characters where my rule

RewriteCond %{HTTP_HOST} ^(www\.$) [NC]

was only matching the www.

Thanks for the tweak.

       
Ryan M.'s avatar
Ryan M.
1,511 posts
16 years ago
Ryan M.'s avatar Ryan M.

I will await my LG Addon Updater to tell me when this new version is available. 😉

       
NKT com's avatar
NKT com
124 posts
16 years ago
NKT com's avatar NKT com

Hi Leevi,

I just installed the multi-site manager on a site using this plugin and am getting the following error

Notice: Undefined index: 2 in /home/username/public_html/admin/extensions/ext.lg_htaccess_generator_ext.php on line 139

Notice: Undefined index: 2 in /home/username/public_html/admin/extensions/ext.lg_htaccess_generator_ext.php on line 139

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/username/public_html/admin/extensions/ext.lg_htaccess_generator_ext.php:139) in /home/username/public_html/admin/extensions/ext.lg_htaccess_generator_ext.php on line 672
       
Leevi Graham's avatar
Leevi Graham
1,143 posts
16 years ago
Leevi Graham's avatar Leevi Graham
Hi Leevi, I just installed the multi-site manager on a site using this plugin and am getting the following error
Notice: Undefined index: 2 in /home/username/public_html/admin/extensions/ext.lg_htaccess_generator_ext.php on line 139

Notice: Undefined index: 2 in /home/username/public_html/admin/extensions/ext.lg_htaccess_generator_ext.php on line 139

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/username/public_html/admin/extensions/ext.lg_htaccess_generator_ext.php:139) in /home/username/public_html/admin/extensions/ext.lg_htaccess_generator_ext.php on line 672

You’ll need to save the extension settings in the 2nd MSM site. I have implemented a fix in all of my extensions for this issue over the weekend. Hopefully I’ll be able to push out the updates soon.

       
Leevi Graham's avatar
Leevi Graham
1,143 posts
16 years ago
Leevi Graham's avatar Leevi Graham
I will await my LG Addon Updater to tell me when this new version is available. 😉

LG Addon Updater won’t tweak your extension settings when you upgrade. But you will get some tweaks 😊

       
gregm's avatar
gregm
6 posts
16 years ago
gregm's avatar gregm

I just installed the latest version. But for some reason I received a 500 internal server error when I clicked the submit & generate button.

Thanks

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

@Greg.. could be any number of reasons. Can you create a pastie of the generated file?

       
gregm's avatar
gregm
6 posts
16 years ago
gregm's avatar gregm

Thanks for the quick answer, here is the info:

– 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?/site/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]

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 %{REQUEST_URI} !(.[a-zA-Z0-9]{1,5})$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} ^/(site|search|embed_pages|box|blog|company|services|tools|publications|clients||members|P[0-9]{2,8}) [NC] RewriteRule ^(.*)$ /index.php?/$1 [L]

Remove IE image toolbar

<FilesMatch “.(html|htm|php)$”> Header set imagetoolbar “no” </FilesMatch>

– LG .htaccess Generator End –

       
misu's avatar
misu
30 posts
16 years ago
misu's avatar misu

is the generator working with the ee function “write blacklist to htaccess”? no overwriting problems?

       
First 2 3 4 5 6 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.