RewriteRule Slows Down Whole Site
Dec 13, 2007I came up with a rule that gives translates the following:
www.example.com/home/HomeSubPage/
to
www.example.com/index.php?var=home/HomeSubPage/
Now, this works - if I echo out the var GET variable, I get
home/HomeSubPage/
But when I was just testing on a simple file it worked fine for about 90% of the time, and the other 10% it got stuck and kept firefox in loading mode ( i had to restart apache to get to run again)
But it really really slows down the web site I am applying this to 100% of the time. The html isnt rendered in the browser, but if I hit view source, it shows me all the source...and its still says its loading. I have to wait about 2 minutes before the html is rendered.
In the code below, I commented out the second last line, that will translate
www.example.com/home.html
to
www.example.com/index.php?var=home
now THAT works flawlessly 100% of the time, so that confirms that the problem is probably in my RewriteRule and not the web site.
I have the following in my .htaccess file:
Code:
Options
RewriteEngine on
RewriteCond %{REQUEST_URI} !-d
RewriteCond %{REQUEST_URI} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^([-a-zA-Z0-9/]+).html$ index.php?var=$1 [L]
RewriteRule ^((([-a-zA-Z0-9]+)/?)+)/?$ /index.php?var=$1 [L]