I have a fresh installation of EE and I’ve only added extensions, modules, and plugins. Other than that, I have no custom content in it yet. I usually do the .htaccess removal of index.php manually, but thought I’d try this. Upon trying to implement the .htaccess generator, I get 404 Not Found pages. Here’s what I did:
Install and enable extension. Generate .htaccess file Remove index.php from url to root directory of site in preferences Remove index.php from name of index page in preferences
Also, I’m not using pages module, so I removed {pages} to get rid of the double pipe. My url’s show up correctly, with no index.php, but again, I’m landing on 404 Not Found pages.
Here’s my .htaccess output
# -- 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]
# 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
#not using pages module RewriteCond %{REQUEST_URI} ^/(site|search||members|P[0-9]{2,8}) [NC]
RewriteCond %{REQUEST_URI} ^/(site|searchmembers|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 --
Another small note: If I turn on Force Query Strings, then it sort of works. I just end up with a ? in my urls, such as www.website.com/?/site/archives/
I haven’t seen anyone having these issues yet.
Wicked extension Leevi - you just saved my bacon.
I’m working on a client server with a different config than I’m used to and finally decided to use your extension instead of running around in the same circles I have been for the last few hours. It worked beautifully, first time!
Cheers
Jim
I had some trouble with your example rewrite code for removing ‘www’ and also the removal of index.php, so this is what I ended up using: The example you gave just didn’t work so I had to use the one below.</code></pre># remove the www RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC] RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
I just ran into this problem myself - thanks for this 😊
I’m using LG htaccess generator to remove the index.php from a site, and it’s working fine except it’s breaking the .swf link on the home page.
the site is here: http://www.artforedison.org
and here’s the code from the htaccess file:
# -- 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 /
# Add the www
RewriteCond %{HTTP_HOST} ^site\.org
RewriteRule ^(.*)$ http://www.site.org/$1 [R=permanent,L]
# 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]
# 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|events|news|sponsors|contact|learn|team|the-plan|act|bumpers|restaurant|10-club|street-team|other-questions|faq|support|shindig|contest|run|consign|members|P[0-9]{2,8}) [NC]
RewriteRule ^(.*)$ /index.php?$1&%{QUERY_STRING}
# Remove IE image toolbar
<FilesMatch "\.(html|htm|php)$">
Header set imagetoolbar "no"
</FilesMatch>
# -- LG .htaccess Generator End --
I have absolute paths for the .swf file, and absolute paths for swfobject, which I’m using to embed the .swf file. Any ideas?
Below is the .htaccess file that is generated. Unfortunately, the links are still including “index.php”. After reviewing previous posts, I’ve made sure to remove index.php from “Name of your site’s index page” field. I removed {ee:pages} to correct an issue with the CSS not loading properly. Finally, I also tested the .htaccess file to make sure it’s being loaded, which it is. What can I being doing wrong?
# -- 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]
# 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} ^/(zz_site|search|site|embeds|about|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 --
PROBLEM SOLVED: Web host is running an IIS windows server and didn’t have ISAPI_REWRITE enabled.
I’ve used this extension one other time and it worked just fine, but this client has their host on a windows server which has created a few problems.
First, I couldn’t find the .htaccess file, so I created a blank file and uploaded it; next, I installed/enabled the extension. Everything worked as expected, I got a success message. Then I went checked out my .htaccess file and it had the right content in it, but when I try and go to a site without the /index.php, my page can’t be found.
Any ideas why it’s not working. Here is my .htaccess file, it located in my root directory:
# -- 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]
# 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} ^/(_scripts|site|_embed|youturn|see-and-hear|_components|survey|staff-access|who-we-are|_css|insider|this-week|blog|sermons|news|ministries|fusion-groups|increase|get-started|more|gallery|servicelink|events|mediaplayer|videos|missions|gallery-private|debtsurvey|prayer| |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 --
You have to open up your .htaccess file and remove the extra pipe character. In the Include method rules section is the line that has all the template groups to include. Look for a double pipe characters. Delete one, and you should be good. As far as I know, this is the only solution at the moment.
I’m having a bit of a problem with MSM and LG .htacccess Generator - basically the 2nd site won’t show, it gets shown as the default site; http://ellislab.com/forums/viewthread/119082/ - at least I think it’s the htaccess, disabling it on the first site shows the 2nd OK…
Any ideas?
Thanks,
Edit - I seem to have solved it by adding the directory name to the two major rules at the bottom of the .htaccess.
Every thing is going great with this plugin except one thing. I’m using the Structure module to create my static pages instead of the ee pages module. If I create a new page through structure which has no parent. I always get a 404 on that page url until I go in to the LG .htaccess settings and click submit & regenerate. I do have the {ee:pages} tag in the .htaccess settings and from what I understand Structure mimics pages when creating them. I assumed that when creating a new page LG .htaccess would automatically update. If this is true I guess I’m running into a bug.
Any help would be greatly appreciated.
Every thing is going great with this plugin except one thing. I’m using the Structure module to create my static pages instead of the ee pages module. If I create a new page through structure which has no parent. I always get a 404 on that page url until I go in to the LG .htaccess settings and click submit & regenerate. I do have the {ee:pages} tag in the .htaccess settings and from what I understand Structure mimics pages when creating them. I assumed that when creating a new page LG .htaccess would automatically update. If this is true I guess I’m running into a bug. Any help would be greatly appreciated.
I’m only checking to see if a page is created using the pages module before the .htaccess is regenerated. I’ll look into Structure integration for the next release.
While I don’t know what the issue is, I do know that I’m using Structure and .htaccess Generator together successfully. That actually sounds like a problem I ran into with Structure myself - the exact same symptom. The solution was to have Travis et. al look into it and do some fiddling (the bug was on the Structure end). I never did fine out exactly what they did, only that they fixed it and I honestly don’t know if that fix made into the general release (I don’t think so?). I’d try in that thread if you haven’t already.
Actually I lied. I’m having the same problem that Jeff Adams is having - any new top-level page throws a 404 error because .htaccess isn’t being updated. The work-around is to manually regenerate the file through the LG .htaccess extension control panel. Any word on an update?
Thanks!
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.