Our optimised ExpressionEngine htaccess file – Web Performance
The htaccess file is one of the smallest on any linux powered website yet it's the most powerful. Many problems can arise from an htaccess file. If you are having any redirect or problem with your ExpressionEngine urls then it's likely that the htaccess file could be that gremlin you need to fix.
The redirects need to be in that order for them to work. Altering what part of the redirect is read by the server and the order can affect results greatly.
At Media Surgery we take web performance very seriously and a lot of the above htaccess is for just that - performance. Gzipping, Expires and Etags can have a significant effect on page load time and activating them is good practice and a good idea.
With this technique of using the redirect you will need to put an "RewriteEngine off" in an another htaccess file in your system folder to stop that from redirecting and not being able to access the control panel.
SEO: Canonical issues in search engine optimisation can arise from having both www. And non www. based urls hence why we have redirected all pages to have a url starting with www.
SEO: Slashes in urls can also have search engine effects. Removing or forcing slashes is again good practice and will help with canonical issues. In this case we are removing the trailing slash at the end of every url.
SEO: The final line redirects older pages that have moved to a new location. This again helps if you have links pointing at older pages and want the 'juice' to be transferred to that new page.