Davor Peic.Gavran Portfolio
Hrvatski English Español
21May
2008

Removing index.php from URLs for better SEO optimization, htaccess, PHP 5.2.6 and ExpressionEngine

Permalink 28 Posted in: ExpressionEngine Tutorials

Finally my site runs at PHP5, MySql 5. As I announced few months ago, but that happened few days ago. We can feel a little speed up, but besides that, and of course new PHP5 features, there is all like before.

As there is always "but", I experienced some little headache problems. My rewrite rule for removing index.php from URL just stopped working. In that moment I didn’t knew that the update already happened. I was using tutorial from the wiki page of ExpressionEngine

Old rewrite rule:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

If you had un update of php version to 5.2.6 like me, you can try this solution. This worked for me:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]

NOTE: The blue question mark after index.php. This is working on HostGator servers, maybe for some strange reason, is not working on your site/server.

More about the solution at ExpressionEngine Forum

Update

Just received a very useful comment of Levi Graham. He published one cool extension for EE called LG .htaccess Generator. So, for more .htaccess and ExpressionEngine things, check his page.

About
AboutMy name is Davor Peich-Gavran. I'm 28 years old freelance designer from Croatia. I moved to México about two years ago. Hope you like my blog/portfolio.
Cosmosart is powered by ExpressionEngine
Copyright

This site, that means all my designs and photos are under Creative Commons Licence.

That means that you can use my work, but only if you don't change it or publish under other name. If you planing to use somewhere my work, contact me!