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

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

Btw, I just I got this error message when hitting the back button in the control panel. I was editing custom field instructions at the time.

Notice: Undefined index: group_id in /home/username/public_html/admin/cp/cp.publish_ad.php on line 8254

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/username/public_html/admin/cp/cp.publish_ad.php:8254) in /home/username/public_html/admin/extensions/ext.lg_htaccess_generator_ext.php on line 672
       
saidss's avatar
saidss
14 posts
16 years ago
saidss's avatar saidss

Hi Leevi

I just installed the plugin and its working fine except for the forum. It redirects back to the main site, so basically does the extension also work for the forum as well and if it does, what must be done

Thanks & Regards Said

       
Leevi Graham's avatar
Leevi Graham
1,143 posts
16 years ago
Leevi Graham's avatar Leevi Graham
Hi Leevi I just installed the plugin and its working fine except for the forum. It redirects back to the main site, so basically does the extension also work for the forum as well and if it does, what must be done Thanks & Regards Said

I haven’t setup the extension with the forum before so I can’t comment for sure. But if your form is located at /forum/ why don’t you just add “forum” into the extension settings before {ee:templates}

       
Leevi Graham's avatar
Leevi Graham
1,143 posts
16 years ago
Leevi Graham's avatar Leevi Graham
Hi Leevi, the corrupt data was just a one off. Seems fine now.

Excellent

However on another site on a different host the index page loads without CSS. All other pages load fine but not the index page. Nother rules in the HTACESS file other than what this thing puts in. http://www.mysite.org/ < No styling I’m using using EE stylesheet tags.

LG .htaccess generator just adds the template groups and pages to the .htaccess. You may need to tweak your settings for individual setups. What is the path to your CSS?

       
saidss's avatar
saidss
14 posts
16 years ago
saidss's avatar saidss

Hi Leevi,

Thanks for that tip, works fine now

Regards Said

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

Hi Leevi,

the CSS template group is called “styles”. Here is the remove index.php code it made.

# 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|styles|feeds|includes|reports|press|news|what-you-can-do|protesting|chronicle|mobile|xml|search|sitemaps|tools|translation|tell-a-friend|video|coming-soon|language|groups||members|P[0-9]{2,8}) [NC]
RewriteRule ^(.*)$ /index.php?/$1 [L]

Thanks for your help.

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

What is the url to the CSS file as its rendered in your page source?

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

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

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

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.

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

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

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

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

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

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

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

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.

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

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?

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