Can .htaccess slow down a site?
- by Cody Sharp
I'm working with a client on an e-commerce website. I implemented clean URLs using .htaccess. I also used .htaccess to solve canonical issues such as redirecting www to non-www and removing index.php from the URL.
The website recently began to slow down dramatically, sometimes not even loading. The site is hosted on GoDaddy, and when the client called GoDaddy they told him it was the .htaccess file slowing down the website. I find this highly unlikely because of my past experiences, but I'm not 100% sure. My thinking is that the client's website is most likely on a shared server with a busy neighborhood, thus slowing down the site. It's not always slow, but rather sporadic throughout the day, loading fast at some points and slow at other points in time.
Can the .htaccess file slow down a website to a crawl? If so, are there better ways to solve these problems with different rewrite rules and such?
Here is what the actual .htaccess file looks like:
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.example.net [NC]
RewriteRule ^(.*)$ http://example.net/$1 [L,R=301]
RewriteRule ^products/([0-9a-zA-Z\_\-]*)\.htm([l]?)$ index.php p=product&product_code=$1 [L]
RewriteRule ^catalog/([0-9a-zA-Z\_\-]*)\.htm([l]?)$ index.php p=catalog&catalog_code=$1 [L]
RewriteRule ^pages/([0-9a-zA-Z\_\-]*)\.htm([l]?)$ index.php?p=page&page_id=$1 [L]
RewriteRule ^index\.htm([l]?)$ index.php?p=home [L]
RewriteRule ^site_map\.htm([l]?)$ index.php?p=site_map [L]
RewriteCond %{QUERY_STRING} ^p=home$
RewriteRule (.*) ? [R=permanent]
I'm a .htaccess and regex novice, so any pointed out mistakes would also help.
Thank you.