3 of 11
3
LG .htaccess Generator
Posted: 15 September 2008 12:35 AM   [ Ignore ]   [ # 37 ]  
Lab Assistant
RankRank
Total Posts:  198
Joined  06-06-2007

<link rel=“stylesheet” type=“text/css” media=“screen” href=“http://www.mysite.org/?css=styles/boilerplate.v.1217586324” />
<link rel=“stylesheet” type=“text/css” media=“screen” href=“http://www.mysite.org/?css=styles/index.v.1221399893” />
<link rel=“stylesheet” type=“text/css” media=“print” href=“http://www.mysite.org/?css=styles/print.v.1217586324” />

Profile
 
 
Posted: 16 September 2008 06:27 PM   [ Ignore ]   [ # 38 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1757
Joined  03-26-2006

This is a neat extension, as I like the more proper include/exclude methods for delivering errors, but I hate manually editing the .htaccess file when adding a template group - so this is perfect.

The problem I’m having is that I can’t access my system folder when it is enabled. I generally mask the CP using another folder called “admin” or something similarly simple, but whether I try using the masked folder or the actual system folder name I get my EE 404 error page. Am I supposed to add these folders to the htaccess via the settings?

EDIT/ADD: I guess I need to qualify this a little. I’m in FF3…I can log into the CP in one tab, but not more than one. Weird.

 Signature 

ryan masuga
—————
Masuga Design | devot:ee
@masuga | @masugadesign | @devot_ee

Profile
 
 
Posted: 17 September 2008 08:14 AM   [ Ignore ]   [ # 39 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1336
Joined  01-24-2006
Turkish Baker - 15 September 2008 04:35 AM

<link rel=“stylesheet” type=“text/css” media=“screen” href=“http://www.mysite.org/?css=styles/boilerplate.v.1217586324” />
<link rel=“stylesheet” type=“text/css” media=“screen” href=“http://www.mysite.org/?css=styles/index.v.1221399893” />
<link rel=“stylesheet” type=“text/css” media=“print” href=“http://www.mysite.org/?css=styles/print.v.1217586324” />


Hmm… try updating the last line of the rewrite to:

RewriteRule ^(.*)$ /index.php?/$1 [L,R=301] 

That will cause your browser to redirect and show the url… It might bring something to light.

@Masuga: try this as well and see what happens.

 Signature 

EE-Garage.com - All my ExpressionEngine 2 Addons!


EE2 - NSM Better Meta - SEO Meta & XML Sitemap Generator
EE2 - NSM Live Look - Real entry previews


Newism - Newcastle - ExpressionEngine Experts

Profile
 
 
Posted: 17 September 2008 08:15 AM   [ Ignore ]   [ # 40 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1336
Joined  01-24-2006
Turkish Baker - 15 September 2008 04:35 AM

<link rel=“stylesheet” type=“text/css” media=“screen” href=“http://www.mysite.org/?css=styles/boilerplate.v.1217586324” />
<link rel=“stylesheet” type=“text/css” media=“screen” href=“http://www.mysite.org/?css=styles/index.v.1221399893” />
<link rel=“stylesheet” type=“text/css” media=“print” href=“http://www.mysite.org/?css=styles/print.v.1217586324” />

Hey Turkish… you might also want to take a look at: http://newism.com.au/blog/post/56/expressionengine-campaign-monitor-google-analytics-and-url-rewrites/ to see if here is any clues. From what I can tell it’s kind of the same principle.

Cheers

 Signature 

EE-Garage.com - All my ExpressionEngine 2 Addons!


EE2 - NSM Better Meta - SEO Meta & XML Sitemap Generator
EE2 - NSM Live Look - Real entry previews


Newism - Newcastle - ExpressionEngine Experts

Profile
 
 
Posted: 17 September 2008 12:01 PM   [ Ignore ]   [ # 41 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1757
Joined  03-26-2006

I’ve found that adding index.php to the end of any admin folder URL (masked or regular) seems to solve the issue. When I update the one line in the .htaccess file to read

RewriteRule ^(.*)$ /index.php?/$1 [L,R=301] 

the following happens:

http://www.site.com/r3alsyst3m/
goes to:
http://www.site.com/index.php?/r3alsyst3m/

and

http://www.site.com/admin/
goes to:
http://www.site.com/index.php?/admin/

However, going to http://www.site.com/admin/index.php or http://www.site.com/r3alsyst3m/index.php works fine for both (but I also have to manually add both admin folder names to the include list).

 Signature 

ryan masuga
—————
Masuga Design | devot:ee
@masuga | @masugadesign | @devot_ee

Profile
 
 
Posted: 17 September 2008 05:59 PM   [ Ignore ]   [ # 42 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1336
Joined  01-24-2006

Hey Ryan,

Can you paste your full .htaccess. Unless the folder ‘admin’ is in the include list the rule should not be executing and it should work fine.

Cheers

 Signature 

EE-Garage.com - All my ExpressionEngine 2 Addons!


EE2 - NSM Better Meta - SEO Meta & XML Sitemap Generator
EE2 - NSM Live Look - Real entry previews


Newism - Newcastle - ExpressionEngine Experts

Profile
 
 
Posted: 17 September 2008 06:14 PM   [ Ignore ]   [ # 43 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1757
Joined  03-26-2006

This is what is currently working, as long as we have ‘index.php’ at the end of a URL for our admin folder, whether using masked access or not:

# -- 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} ^/(admin|_realsystem|forums|site|search|tg1|tg2|tg3||members|P[0-9]{2,8}[NC]
RewriteRule 
^(.*)$ /index.php?/$1 [L]
# RewriteRule ^(.*)$ /index.php?/$1 [L,R=301]

# Remove IE image toolbar
<FilesMatch "\.(html|htm|php)$">
  
Header set imagetoolbar "no"
</FilesMatch>

# -- LG .htaccess Generator End -- 

Note that, even though they shouldn’t be in there, I had to add both system folders (real, masked) to the list (admin|_realsystem). I have specified an error template, called “404” in the site template group. I also manually added “forums” to the include list.

EDIT/ADD:
I don’t know if the “remove www” rule is supposed to work or not, but it never does actually remove the “www”. The “add trailing slash” rule seems to work, though.

 Signature 

ryan masuga
—————
Masuga Design | devot:ee
@masuga | @masugadesign | @devot_ee

Profile
 
 
Posted: 17 September 2008 06:30 PM   [ Ignore ]   [ # 44 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1336
Joined  01-24-2006

Firest thing I would do is remove the _realsystem and admin from your include line. Having them there is always going to cause a redirect and include the .php. The next thing I would do is, if you do not have pages remove the pipe that seperates {ee:template_groups} and {ee:pages}. Try the line below:

RewriteCond %{REQUEST_URI} ^/(forums|site|search|tg1|tg2|tg3|members|P[0-9]{2,8}[NC] 

Also which version of apache are you using?

 Signature 

EE-Garage.com - All my ExpressionEngine 2 Addons!


EE2 - NSM Better Meta - SEO Meta & XML Sitemap Generator
EE2 - NSM Live Look - Real entry previews


Newism - Newcastle - ExpressionEngine Experts

Profile
 
 
Posted: 17 September 2008 06:31 PM   [ Ignore ]   [ # 45 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1336
Joined  01-24-2006

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

 Signature 

EE-Garage.com - All my ExpressionEngine 2 Addons!


EE2 - NSM Better Meta - SEO Meta & XML Sitemap Generator
EE2 - NSM Live Look - Real entry previews


Newism - Newcastle - ExpressionEngine Experts

Profile
 
 
Posted: 17 September 2008 07:48 PM   [ Ignore ]   [ # 46 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1757
Joined  03-26-2006

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

 Signature 

ryan masuga
—————
Masuga Design | devot:ee
@masuga | @masugadesign | @devot_ee

Profile
 
 
Posted: 17 September 2008 08:50 PM   [ Ignore ]   [ # 47 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1336
Joined  01-24-2006

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!

 Signature 

EE-Garage.com - All my ExpressionEngine 2 Addons!


EE2 - NSM Better Meta - SEO Meta & XML Sitemap Generator
EE2 - NSM Live Look - Real entry previews


Newism - Newcastle - ExpressionEngine Experts

Profile
 
 
Posted: 17 September 2008 09:26 PM   [ Ignore ]   [ # 48 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1757
Joined  03-26-2006

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

 Signature 

ryan masuga
—————
Masuga Design | devot:ee
@masuga | @masugadesign | @devot_ee

Profile
 
 
Posted: 17 September 2008 09:48 PM   [ Ignore ]   [ # 49 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1336
Joined  01-24-2006

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

 Signature 

EE-Garage.com - All my ExpressionEngine 2 Addons!


EE2 - NSM Better Meta - SEO Meta & XML Sitemap Generator
EE2 - NSM Live Look - Real entry previews


Newism - Newcastle - ExpressionEngine Experts

Profile
 
 
Posted: 18 September 2008 04:50 PM   [ Ignore ]   [ # 50 ]  
Summer Student
Total Posts:  4
Joined  07-29-2008

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.

Profile
 
 
Posted: 18 September 2008 05:32 PM   [ Ignore ]   [ # 51 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1336
Joined  01-24-2006

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.

 Signature 

EE-Garage.com - All my ExpressionEngine 2 Addons!


EE2 - NSM Better Meta - SEO Meta & XML Sitemap Generator
EE2 - NSM Live Look - Real entry previews


Newism - Newcastle - ExpressionEngine Experts

Profile
 
 
Posted: 18 September 2008 07:51 PM   [ Ignore ]   [ # 52 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1757
Joined  03-26-2006

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

 Signature 

ryan masuga
—————
Masuga Design | devot:ee
@masuga | @masugadesign | @devot_ee

Profile
 
 
Posted: 19 September 2008 01:13 PM   [ Ignore ]   [ # 53 ]  
Lab Assistant
RankRank
Total Posts:  198
Joined  06-06-2007

Hi Leevi,

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

NoticeUndefined index2 in /home/username/public_html/admin/extensions/ext.lg_htaccess_generator_ext.php on line 139

Notice
Undefined index2 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:139in /home/username/public_html/admin/extensions/ext.lg_htaccess_generator_ext.php on line 672 
Profile
 
 
Posted: 21 September 2008 07:01 PM   [ Ignore ]   [ # 54 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1336
Joined  01-24-2006
Turkish Baker - 19 September 2008 05:13 PM

Hi Leevi,

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

NoticeUndefined index2 in /home/username/public_html/admin/extensions/ext.lg_htaccess_generator_ext.php on line 139

Notice
Undefined index2 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:139in /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.

 Signature 

EE-Garage.com - All my ExpressionEngine 2 Addons!


EE2 - NSM Better Meta - SEO Meta & XML Sitemap Generator
EE2 - NSM Live Look - Real entry previews


Newism - Newcastle - ExpressionEngine Experts

Profile
 
 
   
3 of 11
3