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

daithi's avatar
daithi
38 posts
15 years ago
daithi's avatar daithi

Just a quick and I hope easy to answer question: Will links to old URLs (including index.php) still work, with the htaccess generator installed? Many thanks!

       
django6's avatar
django6
124 posts
15 years ago
django6's avatar django6

I’ve installed this extension once before and it worked for me, but it’s been awhile and I’m sure I’ve forgotten something. Is there a more detailed set of instructions somewhere? My current site is in a subfolder and I read that I have to modify the rules to add the subfolder. I’ve tried that, and it’s generating the .htaccess fine, but the index.php remains. I also read somewhere that I have to remove index.php in the admin page. I tried that, but then it doesn’t pick up my css and the index.php remains. Any suggestions?

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
15 years ago
Ingmar Greil's avatar Ingmar Greil

Yes, of course.

       
Ben Brunt's avatar
Ben Brunt
15 posts
15 years ago
Ben Brunt's avatar Ben Brunt

I am now receiving this error on my site. This extension was working for a few weeks and now it gives me a ISE 500.

[Sun Jan 31 08:16:25 2010] [alert] [client 173.162.208.210] /home/47513/domains/benbrunt.com/html/.htaccess: RewriteEngine must be On or Off, referer: http://www.benbrunt.com/

I need to know what to do or to completely remove it from my site and figure out another way to take the index.php out of the url.

Thanks for the help!

       
Milsoft's avatar
Milsoft
27 posts
15 years ago
Milsoft's avatar Milsoft

I use this extension, and I love it!

However, I need to force SSL https access for all pages. How would I do that in the generated .htaccess file?

Thanks!

       
iDVB's avatar
iDVB
56 posts
15 years ago
iDVB's avatar iDVB
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

I’m sure it’s here somewhere in the forums….but I’ve searched and googled and even send out henchmen to find, with no success…

IF I am using MSM like: www.site1.com www.site2.com

that point to these dirs: /ee/site1 /ee/site2

system is here: /ee/system/ (yes I’ve changed the name 😉)

WHERE do I put the .htaccess file? Do I need one for each site dir or just one? If just one, where does it go?

Cheers, D

       
Hal Ashman's avatar
Hal Ashman
2 posts
15 years ago
Hal Ashman's avatar Hal Ashman

Hello all,

I just enabled this extension and got this in the admin section of my site.

Warning: Missing argument 1 for show_full_control_panel_end() in /nfs/c06/h02/mnt/90841/domains/ultimatewatersports.com/html/system/extensions/ext.lg_htaccess_generator_ext.php on line 663

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /nfs/c06/h02/mnt/90841/domains/ultimatewatersports.com/html/system/extensions/ext.lg_htaccess_generator_ext.php:663) in /nfs/c06/h02/mnt/90841/domains/ultimatewatersports.com/html/system/extensions/ext.lg_htaccess_generator_ext.php on line 672

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /nfs/c06/h02/mnt/90841/domains/ultimatewatersports.com/html/system/extensions/ext.lg_htaccess_generator_ext.php:663) in /nfs/c06/h02/mnt/90841/domains/ultimatewatersports.com/html/system/extensions/ext.lg_htaccess_generator_ext.php on line 672

Notice: Undefined variable: out in /nfs/c06/h02/mnt/90841/domains/ultimatewatersports.com/html/system/extensions/ext.lg_htaccess_generator_ext.php on line 689

I can not figure out how to get this to resolve itself. the front end works but the admin shows the above.

       
Hal Ashman's avatar
Hal Ashman
2 posts
15 years ago
Hal Ashman's avatar Hal Ashman

Just wanted to add.

I have no other extensions installed I am using version 1.6.8 The above message displayed after I clicked “enable extension” I am on Media temple grid server hosting

       
Tomaz's avatar
Tomaz
9 posts
15 years ago
Tomaz's avatar Tomaz

Hey I have a small issue with generated rules. When i want to go to CP i need to enter domain.com/system/index.php manually otherwise i get 404. I also have some folders with different apps like domain.com/app/index.php and those get rewritten too. How could i prevent that?

Tom

       
Fred Carlsen's avatar
Fred Carlsen
42 posts
15 years ago
Fred Carlsen's avatar Fred Carlsen

On my install with 1.6.8+Structure 1.3.1, the following part of the default setup gets messed up.

RewriteCond %{REQUEST_URI} ^/({ee:template_groups}|{ee:pages}|members|P[0-9]{2,8}) [NC]

Somehow, in the created .htaccess file, there is added an extra pipe character between groups and structure pages, which caused my control panel url to redirect to the main index.php unless I specified system/index.php (I have masked it with another name).

I fixed it by removing the pipe in the setup, like so:

RewriteCond %{REQUEST_URI} ^/({ee:template_groups}{ee:pages}|members|P[0-9]{2,8}) [NC]

But, is there anything wrong in adding a directory check right after the filecheck to the default setup? Seems logical to me.

# Remove index.php by include method
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5})$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d # DIRECTORY CHECK
RewriteCond %{REQUEST_URI} ^/({ee:template_groups}{ee:pages}|members|P[0-9]{2,8}) [NC]
RewriteRule ^(.*)$ /index.php?/$1 [L]

UPDATE: It gets more complicated now. On one site where I don’t use Structure/Pages, I removed {ee:pages} and the following pipe char, which gave me this .htaccess file: http://pastie.org/907941

My setup is all based on conditionals and segments, so I don’t actually use the template group in the url. Should I use the exclude method?

On a sidenote, on this particular site where I only use categories/entry urls, I get a log entry like this for every request:

[Wed Apr 07 20:14:33 2010] [error] [client 72.123.20.124] File does not exist: /home/users/user/subdomain/entryurl, referer: http://subdomain.user.com/entryurl2/

It shows the same for all category urls. Is anything wrong with the default LG .htaccess setup, or is this to be expected with my segment based setup?

       
Frank Harrison's avatar
Frank Harrison
154 posts
15 years ago
Frank Harrison's avatar Frank Harrison

I used this to create my .htaccess file, and then switched it off. I’ve just moved my site to a different server, and it was crashing a lot (server was just timing out on everything after a while until I restarted it). I looked at the server’s error logs, and was getting a lot of errors like this:

Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /var/www/vhosts/sitename.com/httpdocs/index.pl, referer: http://www. sitename.com/about-us/

They seemed to be triggered every time I visited the home page (other pages didn’t have this effect). A bit of googling suggested I should add this code to my .htaccess:

<Files ~ (\.pl)>
Options ExecCGI FollowSymLinks
</Files>
Options +FollowSymLinks +SymLinksIfOwnerMatch

I did so, and the errors in the log went away, but I’m wondering if the above could have any negative effect on EE, or conflict with any of the stuff that this plugin generated for .htaccess?

Here’s my whole .htaccess in case that helps…

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

# -----------------------
# THIS IS THE STUFF I'VE ADDED...
#-----------------------
<Files ~ (\.pl)>
Options ExecCGI FollowSymLinks
</Files>
Options +FollowSymLinks +SymLinksIfOwnerMatch

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 %{QUERY_STRING} !(ACT=[0-9]{1,3})
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5})$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^/(embeds|site|search|register|news|contact-us|about-us|pages|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 --
       
Tim Smith's avatar
Tim Smith
15 posts
15 years ago
Tim Smith's avatar Tim Smith

I think some of the issues people have with extra pipe characters in the htaccess rules may be due to the home page being set up as a page, i.e. the page url is /. In my case this stopped the css file from being loaded.

The p[age url being just / causes the LG htaccess generator to put out an empty page into the pages list causing the double pipe. In my case all this did was stop the css file from being loaded, it may possibly cause other problems too, but in any case a little tweak to LG’s code sorts it out.

In ext.lg_htaccess_generator_ext.php at line 566 change

if(isset($parts[0]) === TRUE)
                    {
                            $page_roots[] = $parts[0];

                    }

to

if(isset($parts[0]) === TRUE)
                    {
                        if($parts[0] != "")
                        {
                            $page_roots[] = $parts[0];
                        }
                    }

This stops an extra pipe being output if the page url is just / and my CSS loads fine.

       
Christopher Kennedy's avatar
Christopher Kennedy
44 posts
15 years ago
Christopher Kennedy's avatar Christopher Kennedy

Hey all. I’m curious if there’s an easy solution or if I’m making myself a world of hurt.

Basically, I’m working on a website, where the url path they desire is weslgt.com/in/houston where in/houston is replacing the index.php. The current setup I have works fine, I’ve replaced the index.php name in the control panel with “in/houston”, and I have this as my .htaccess rule:

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

# Fix queries for actions, urls and css in EE
RewriteCond %{QUERY_STRING} ^(ACT=.*)$ [NC,OR]
RewriteCond %{QUERY_STRING} ^(URL=.*)$ [NC,OR]
RewriteCond %{QUERY_STRING} ^(CSS=.*)$ [NC]   
RewriteRule ^in/houston(.*)$ /index.php\?&%{QUERY_STRING} [L]

# Remove index.php
# Uses the "include method"
# http://expressionengine.com/wiki/Remove_index.php_From_URLs/#Include_List_Method
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^in/houston(.*)$ /index.php/$1 [L]

As you can see, on the last line, I’m replacing the index.php file with in/houston. This works great. However, we can’t really run registrations as a result, because for some reason, when the user completes registration, they are dumped back to the home screen. Erik Reagan has added a string previous to the removal string above to try to force it to go through, but I still can’t get any confirmation either way. Obviously, I see that users aren’t getting registered, but I’m just at a loss as to how I can enable it.

Any thoughts on my half cocked ideas would be appreciated. :D

       
Sean C. Smith's avatar
Sean C. Smith
3,818 posts
15 years ago
Sean C. Smith's avatar Sean C. Smith

Just wondering if there’s a timeline to have this ported over to EE2? No pressure just wondering if it will be ported or not.

       
Deisun's avatar
Deisun
12 posts
15 years ago
Deisun's avatar Deisun

I was wondering the same thing. Is there an EE2.0 equivalent to this?

       
First 10 11 12 13

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.