Posted in Template Code Tutorials
For a long time now I have struggled with removing index.php from my EE websites. I have used a mix bag of the include/exclude method and add-ons that deal with making the include/exclude method easier.
A few weeks ago I was having some issues while creating a multi-language site and Jack McDade sent me a snippet of .htaccess code that has worked on several hosts (including a dedicated mac mini, gatorhost) and is simple. I asked Jack’s permission to post the code and he said yes. So if you find this handy make sure to give him a thanks by purchasing one of his many add-ons or follow on the twitters...
AcceptPathInfo On
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
# Looks for files and directories that do not exist
# and provide the segments to the index.php file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^/index.php
RewriteCond $1 !.(css|js|png|jpe?g|gif|ico)$ [NC]
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
Want to write a blog post? Just use the contact form on the submit page!
This is just a quick blog post to relay some info I just learned. I am in the process of upgrading Show-ee from 1.6.8 to 1.7 and then to 2.1.4b. As part of that site we used to use FieldFrame from Pixel & Tonic. Specifically we were using the
This is the second installment in our Creating installable templates tutorials for ExpressionEngine. In this post we are going to talk about the actual package that needs to be delivered to the end user and all of the associated files. Plus we even
A year ago I was perusing the user guide and wiki over on ExpressionEngine’s website for any information regarding creating your own installable templates. At that time there were none. At I just did a quick search for some of the files involved
In this video we will start with a blank slate and create a usable but simple layout to replace that which is found at Sean Smith’s Repatriate.me. This was not meant to be a end all be all tutorial but rather just a quick post about some of the
Brandon Kelly says:
You should change that last line to:
RewriteRule ^(.+)$ index.php/$1 [L]
(change the asterisk to a plus sign)
If “index.php” is included in your Apache config’s DirectoryIndex (and it usually is), there’s no need to manually redirect a request without a URI over to index.php – Apache’s already giving it to you for free.
Why do I care if you make that change? Because that redirect is going to drop any GET and POST variables that were part of the request. Which means you’re breaking all EE Action URLs (“http://site.com/?ACT=123…”) such as comment unsubscribes, member activation, etc.
03/07 at 10:18 AM
Brandon Kelly says:
Sorry, somehow I skipped over this line:
RewriteCond $1 !^/index.php
That solves the issue as well. Most of these index.php redirects don’t have a line like that.
Still, just changing the asterisk to a plus sign will let you remove that entire line.
03/07 at 10:21 AM
Marcus Neto says:
Thanks Brandon. Most of this stuff is a mystery to me.
Also wanted to point out that Kevin Thompson was discussing the same thing over on his blog yesterday.
http://kevinthompson.info/blog/completely-remove-index-php-from-expressionengine-urls/
03/08 at 12:57 PM