Searching For A .HTACCESS Gods Wisdom :)

17 replies
  • WEB DESIGN
  • |
Hey guys, check out this .HTACCESS code,

Code:
# BEGIN Redirects

RedirectMatch 301 ^/blog/2013/02/07/photo-of-the-week-ford-fusion-looks-like-aston-martin/$ /photo-of-the-week-ford-fusion-looks-like-aston-martin/

RedirectMatch 301 ^/blog/2013/02/07/bmw-4219eli-making-a-4-year-olds-dreams-come-true/$ /bmw-4219eli-making-a-4-year-olds-dreams-come-true/

# END Redirects



# BEGIN Compress text files

<ifModule mod_deflate.c>

	<filesMatch "\.(css|js|x?html?|php)$">

	SetOutputFilter DEFLATE

	</filesMatch>

</ifModule>

# END Compress text files



# BEGIN Expire headers

#<ifModule mod_expires.c>

#	ExpiresActive On

#	ExpiresDefault "access plus 1 seconds"

#	ExpiresByType image/x-icon "access plus 2592000 seconds"

#	ExpiresByType image/jpeg "access plus 2592000 seconds"

#	ExpiresByType image/png "access plus 2592000 seconds"

#	ExpiresByType image/gif "access plus 2592000 seconds"

#	ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"

#	ExpiresByType text/css "access plus 604800 seconds"

#	ExpiresByType text/javascript "access plus 216000 seconds"

#	ExpiresByType application/javascript "access plus 216000 seconds"

#	ExpiresByType application/x-javascript "access plus 216000 seconds"

#	ExpiresByType text/html "access plus 600 seconds"

#	ExpiresByType application/xhtml+xml "access plus 600 seconds"

#</ifModule>

# END Expire headers



# BEGIN Cache-Control Headers

#<ifModule mod_headers.c>

#	<filesMatch "\.(ico|jpe?g|png|gif|swf)$">

#		Header set Cache-Control "max-age=2592000, public"

#	</filesMatch>

#	<filesMatch "\.(css)$">

#		Header set Cache-Control "max-age=604800, public"

#	</filesMatch>

#	<filesMatch "\.(js)$">

#		Header set Cache-Control "max-age=216000, private"

#	</filesMatch>

#	<filesMatch "\.(x?html?|php)$">

#		Header set Cache-Control "max-age=600, private, must-revalidate"

#	</filesMatch>

#</ifModule>

# END Cache-Control Headers



# BEGIN Turn ETags Off

#<ifModule mod_headers.c>

#	Header unset ETag

#</ifModule>

#FileETag None

# END Turn ETags Off



# BEGIN Remove Last-Modified Header

#<ifModule mod_headers.c>

#	Header unset Last-Modified

#</ifModule>

# END Remove Last-Modified Header



# BEGIN WordPress

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

</IfModule>

# END WordPress
Now, click this - 2010 LINCOLN MKZ AWD , Listing | AgentAuto.com
The link takes you to an inventory page and it loads SLOW. I looked at an apache error log and it says there are 10 redirect lol. Our datacenter said that it had to do with the makeup of the HTACCESS file. Anyone have an idea whats causing the redirects in the code above?

Thanks!
#gods #htaccess #searching #wisdom
  • Profile picture of the author KingRoyal
    We also commented out the Cache and Gzip on purpose to test, and no bueno results
    {{ DiscussionBoard.errors[7727694].message }}
  • Kingmighty,

    Structure your redirect like this:

    Redirect 301 /somepage.htm http://www[dot]example[dot]com/someotherpage.htm

    Exclude the word match, only use the request URI of the original URL and use the full URL of the new page.

    For mod_deflate use this,

    <IfModule mod_deflate.c>
    ## enable apache served files compression


    # Insert filter on all content
    SetOutputFilter DEFLATE
    # Insert filter on selected content types only
    #AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript

    # Netscape 4.x has some problems...
    BrowserMatch ^Mozilla/4 gzip-only-text/html

    # Netscape 4.06-4.08 have some more problems
    BrowserMatch ^Mozilla/4\.0[678] no-gzip

    # MSIE masquerades as Netscape, but it is fine
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    # Don't compress images
    SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

    # Make sure proxies don't deliver the wrong content
    Header append Vary User-Agent env=!dont-vary

    </IfModule>

    You might try just playing around with things and seeing if removing some of the code you have in the file speeds up the site. Sometimes its hard to tell what exactly is making it load slowly but I would start with file compression. I doubt its your redirects causing the issue.

    There are some more tips here,
    5 Tips For Faster Loading Web*Sites

    Hope that helps you,

    Shawn
    Signature
    Outsource to the experts...

    We customize your Blog, eBook, Press Release and Sale Copy content with your message.

    {{ DiscussionBoard.errors[7728223].message }}
    • Profile picture of the author KingRoyal
      You really think this will help speed the loads up?
      {{ DiscussionBoard.errors[7728243].message }}
  • Profile picture of the author mojojuju
    There are no redirects when I download that page, but your site is slow.
    Signature

    :)

    {{ DiscussionBoard.errors[7728375].message }}
  • Profile picture of the author KingRoyal
    I checked the apache error log and one entry really stands out.

    [Mon Feb 11 17:05:22 2013] [error] [client 66.249.73.214] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

    It appears to be an issue with how your .htaccess file was developed and causing a bunch of redirects which pretty much confuses apache into where its suppose to go.

    I could not get the log to show it coming from my IP address although that gives the best possible information, as your php error log is not providing much information.
    {{ DiscussionBoard.errors[7728424].message }}
    • Profile picture of the author mojojuju
      Originally Posted by KingMighty View Post


      [Mon Feb 11 17:05:22 2013] [error] [client 66.249.73.214] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
      That's Googlebot and it might be trying some urls that don't matter much to human visitors. Your error log should tell you the request URL that is resulting in errors. Take a look at that, then decide what to do.
      Signature

      :)

      {{ DiscussionBoard.errors[7728478].message }}
  • Profile picture of the author KingRoyal
    How is google bot creating 10 directs though?
    {{ DiscussionBoard.errors[7728481].message }}
    • Profile picture of the author mojojuju
      Originally Posted by KingMighty View Post

      How is google bot creating 10 directs though?

      Googlebot doesn't create redirects on your server. Googlebot is requesting a location and your server is responding by sending a redirect status code and a new location for it to follow. Google follows that, and your server does the same thing all over again. Why I mentioned Google bot is that the urls it requests may not be "normal" urls on your site - ones that would affect human users. Still, you might want to get that fixed.

      The URL in your original post, when requested using the wget program, doesn't result in any redirects. Any hypothesis suggesting that your server is redirecting requests to that url is false.
      Signature

      :)

      {{ DiscussionBoard.errors[7728519].message }}
  • Profile picture of the author KingRoyal
    So what exactly would you suggest that would help us speed the actual pages of the inventory itself? When you go to the home page, or when you perform a search itself, the sites moves quickly, as well as on the news and review page.

    Its literally just the inventory details page.
    {{ DiscussionBoard.errors[7728529].message }}
    • Profile picture of the author mojojuju
      Originally Posted by KingMighty View Post

      So what exactly would you suggest that would help us speed the actual pages of the inventory itself? When you go to the home page, or when you perform a search itself, the sites moves quickly, as well as on the news and review page.

      Its literally just the inventory details page.
      I don't know for sure because it's not my site, but I'd bet that a lot of the sluggishness can be attributed to time taken to query the database. There could be lots of things you could do to remedy that, including getting better hosting if it's the case that your setup can't handle the type of queries you're doing with any amount of tweaking.

      According to WebPagetest - Website Performance and Optimization Test, it took 18 seconds to get the first byte of data from your server. Once that page got out the door, everything else came out relatively quick. I can't really say what is slowing things down cause I don't know what you got going on under the hood, but it's probably some database query(s) that's creating the bottleneck.

      You probably need someone to look at your setup and your .htaccess file isn't what's making everything slow.

      Oh, and as you're using Wordpress, once you get it all figured out, use W3 Total Cache or a similar plugin to cache everything as static html files, that way you won't have to query the database much even if you get that to speed up.
      Signature

      :)

      {{ DiscussionBoard.errors[7728565].message }}
  • Profile picture of the author KingRoyal
    Interesting, see, we just upgraded to an E5 server with 16 GB of ram. We were told the the e5 series were the new powerhouse series from Intel. So we are on a dedicated server for sure so I wouldnt know why the power to query the database would not be there.
    {{ DiscussionBoard.errors[7728574].message }}
    • Profile picture of the author mojojuju
      Originally Posted by KingMighty View Post

      Interesting, see, we just upgraded to an E5 server with 16 GB of ram. We were told the the e5 series were the new powerhouse series from Intel. So we are on a dedicated server for sure so I wouldnt know why the power to query the database would not be there.
      There's more to it than having a server of a minimum specification. All I know is something is not configured optimally. Your database settings could need some tweaking. Or maybe you have a plugin that is running inefficiently. Nobody can know for sure but you or whoever runs your sites and server. Something is holding things up if it's taking 18 seconds to deliver the first byte of data. Redirects are not the issue, and that can be verified by the helpful link that UMS just posted.

      Something is choking your performance. You've got a dedicated server, don't you have someone to set it up properly?
      Signature

      :)

      {{ DiscussionBoard.errors[7729111].message }}
  • Profile picture of the author Michael71
    Morning everyone.

    What I can imagine is this: PHP config and MySQL config should be checked and tweaked. Also the Apache modules should be checked and if one site (I think you have more sites on this server, right?) is heavily visited.

    I have an image hosting site on my server and found out that asians were hotlinking a lot of images. That was one of my problems. I added some htaccess code to deny hotlinking and the problem was solved (hehehe).

    That's why the waiting time is high. The TTFB (Time To First Byte) in this case is extremely high.

    I had similar problems some time ago on another server and had to tweak the PHP configuration.
    Signature

    HTML/CSS/jQuery/ZURB Foundation/Twitter Bootstrap/Wordpress/Frontend Performance Optimizing
    ---
    Need HTML/CSS help? Skype: microcosmic - Test Your Responsive Design - InternetCookies.eu

    {{ DiscussionBoard.errors[7729207].message }}
  • Profile picture of the author KingRoyal
    Nope, just this one site on our server haha. Ill start tracking down the config files to see if something is wrong with those, i hope so
    {{ DiscussionBoard.errors[7730511].message }}
  • Profile picture of the author Michael71
    If you need my help contact me.
    Signature

    HTML/CSS/jQuery/ZURB Foundation/Twitter Bootstrap/Wordpress/Frontend Performance Optimizing
    ---
    Need HTML/CSS help? Skype: microcosmic - Test Your Responsive Design - InternetCookies.eu

    {{ DiscussionBoard.errors[7730639].message }}
  • Profile picture of the author KingRoyal
    Hey Michael71, I sent you a PM, thanks man.
    {{ DiscussionBoard.errors[7730713].message }}

Trending Topics