.htaccess redirect noticably increasing load time
Posted
by
GTCrais
on Stack Overflow
See other posts from Stack Overflow
or by GTCrais
Published on 2012-10-03T11:25:31Z
Indexed on
2012/10/03
21:38 UTC
Read the original article
Hit count: 157
.htaccess
|mod-rewrite
I set up a SEF link via .htaccess RewriteRule to one of the articles on my website just to see how that works, and it does work but it considerably increases the load time of that particular page. On average the articles (including the one I'm talking about, when not using the rewrite rule) load in about 1.3 seconds. With the rewrite rule, the load time is 3.3 seconds on average until the page displays, and the loader thingy in the firefox tab keeps spinning for another 2 seconds. I have WAMP setup on my computer, and the website is being accessed through no-ip.com.
Here is the .htaccess config (very simple, as you can see):
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^o-sw-liji /NewSWL/o-nama.php?body=o-sw-liji
In httpd.conf I have this (somewhere I read this might affect the load time for some reason - searching for files through all the directories or something, I don't remember exactly what I read):
<Directory />
Options None
AllowOverride None
Order deny,allow
Deny from all
</Directory>
DocumentRoot "Z:/Program Files (x86)/wamp/www/"
<Directory "Z:/Program Files (x86)/wamp/www/">
Options None
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Any ideas why .htaccess redirect increases the load time by so much?
UPDATE: so I put a session based counter in the "o-nama.php" script. Apparently when I access the web via the 'normal' link i.e. 'o-nama.php?body=o-sw-liji', the counter increases by one, as it should - it's one page load. But when the page is accessed through the redirected link, i.e. 'o-nama/o-sharewood-liji' the counter increases by 6-8, which naturally makes the load time a lot longer, since it's loading the same page for 6-8 times. I have no idea why this is happening. Any help is appreciated.
© Stack Overflow or respective owner