Tagged: htaccess Toggle Comment Threads | Keyboard Shortcuts

  • Peter Mahoney 12:00 pm on July 17, 2013
    Tags: 301, , domain, htaccess, move address, redirect,   

    Permanently moving website to a new domain 

    You really want to add this to your .htaccess file:

    Redirect 301 / http://your-new-domain

    Let’s break that down.

    • “Redirect” is pretty obvious, it tells the web server to redirect the request.
    • “301” is a special code that tells any search engines that come by that this change is permanent, and they should update their results to reflect the new URL. (Using “302” instead would set it as a temporary move.)
    • “/” just means the entire site, from the very top directory has been moved.
    • http://your-new-domain” or indeed, whatever your new URL is, is the new domain that all requests should be sent to. Note the final “/” on the end.

    Easy peasy! Now all bookmarks, and search engine results will still be valid and get people to your new address, with one short piece of code.

    Permalink | Reply
  • Peter Mahoney 1:18 pm on October 30, 2012
    Tags: , htaccess, , , , web server   

    Speeding up your site 

    There is a slew of methods to speed your site up–which is not only the polite thing to do for your guests–but helps with Speed Engine Optimisation (SEO) too. Google in particular looks at how quickly your site loads when deciding how to rank your site.

    Now, if you’re familiar with web servers then everythign you need to know is written below. If not, this is the sort of thing you want to have an expert do for you; a faster site is too good an opportunity to pass up.

    Browser caching is a process whereby we’re able to reduce the number of HTTP requests the server needs to process, which reduced page load times. Your server tells the visitor’s browser not to look for certain filkes everytime–usually the file that don’t change often anyway.

    Edit your .htaccess file for your site, and include this code:

    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpg "access 1 year"
    ExpiresByType image/jpeg "access 1 year"
    ExpiresByType image/gif "access 1 year"
    ExpiresByType image/png "access 1 year"
    ExpiresByType text/css "access 1 month"
    ExpiresByType application/pdf "access 1 month"
    ExpiresByType text/x-javascript "access 1 month"
    ExpiresByType application/x-shockwave-flash "access 1 month"
    ExpiresByType image/x-icon "access 1 year"
    ExpiresDefault "access 2 days"

    Restart your web server, and you’re done!

    Cache that, baby.

    Permalink | Reply
compose new post
next post/next comment
previous post/previous comment
show/hide comments
go to top
go to login
show/hide help
shift + esc