Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

Results 1 to 3 of 3

Thread: mod_rewrite slowing site

  1. #1

    Afrostyle mod_rewrite slowing site

    Hello,
    I 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:
    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]
    can anyone see the problem?

    Thanks

  2. #2
    Mod_rewrite is very slow, you can either not use it or deal with it basically!

    and what is the point of:
    Code:
    RewriteCond %{REQUEST_URI} !-d
    RewriteCond %{REQUEST_URI} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    Web Design and Web Development blog
    Designer Notice: Browser List for design compatibility

  3. #3
    The second rule may take longer basically because it is performing 3 regex searches (regex is heavy on the processor).
    Web Design and Web Development blog
    Designer Notice: Browser List for design compatibility

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012