Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Getting Started with .htaccess for WordPress

Getting Started with .htaccess for WordPress

An introduction on how to configure your .htaccess file to do more than what WordPress provides by default. The talk will cover basics like setting up a preferred URL, and redirecting old page URLs for better SEO. How to optimize your site’s files using gzip will also be covered, as well as preventing image hot linking, and more. A sample .htaccess file will be provided to all attendees. A useful introduction to a very important file for any shared hosting environment. Presented at WordCamp Montreal 2014.

Shannon Smith

August 17, 2014
Tweet

More Decks by Shannon Smith

Other Decks in Technology

Transcript

  1. Shannon Smith Web Developer Café Noir Design ! ! www.cafenoirdesign.com

    @cafenoirdesign All rights reserved © Café Noir Design Inc., 2014.
  2. What We’ll Cover • Introduction • Getting Started • .htaccess

    for SEO • .htaccess for Security • .htaccess for Optimization • Resources • Closing All rights reserved © Café Noir Design Inc., 2014.
  3. What Is an .htaccess File? .htaccess files (or “distributed configuration

    files”) provide a way to make configuration changes on a per-directory basis Official Apache Documentation All rights reserved © Café Noir Design Inc., 2014.
  4. In English, Please? .htaccess is a configuration file for use

    on web servers running the Apache Web Server software All rights reserved © Café Noir Design Inc., 2014.
  5. When Can We Use .htaccess ? • Apache Web Server

    software • Linux/Unix server • Shared Hosting All rights reserved © Café Noir Design Inc., 2014.
  6. Why Isn’t It Working? “I don’t see anything." Your Text

    Editor Photo:Emilio Labrador All rights reserved © Café Noir Design Inc., 2014.
  7. Why Isn’t It Working? “Are you sure you spelled that

    correctly?" Your English Teacher All rights reserved © Café Noir Design Inc., 2014.
  8. Why Isn’t It Working? “You can’t do that." Apache Photo:Achim

    Hepp All rights reserved © Café Noir Design Inc., 2014.
  9. Why Isn’t It Working? “We don’t allow that for security

    reasons". Your Hosting Provider Photo:Sam Howzit All rights reserved © Café Noir Design Inc., 2014.
  10. Basic Rules of SEO • Don’t repeat yourself • Don’t

    repeat yourself • Don’t repeat yourself Photo: jerebu All rights reserved © Café Noir Design Inc., 2014.
  11. To www or Not to www All rights reserved ©

    Café Noir Design Inc., 2014.
  12. Asset Versioning with wp_enqueue_style <?php wp_enqueue_style( $handle, $src, $deps, $ver,

    $media ); ?> ! <?php wp_enqueue_style( 'example-style', stylesheet.css(), false, '1.0.0', all ); ?> All rights reserved © Café Noir Design Inc., 2014.
  13. Resources • Official Apache Documentation
 http://httpd.apache.org/docs/2.4/howto/htaccess.html • .htaccess made easy

    by Jeff Starr
 http://htaccessbook.com • Protect your WordPress site with .htaccess (.net magazine)
 http://www.netmagazine.com/tutorials/protect-your-wordpress-site-htaccess • Comprehensive guide to .htaccess
 http://www.javascriptkit.com/howto/htaccess.shtml • The Ultimate Guide to .htaccess Files (Nettuts)
 http://net.tutsplus.com/tutorials/other/the-ultimate-guide-to-htaccess-files/ • Practical Mod_Rewrite for Web Developers
 http://www.snipe.net/2009/02/practical-mod_rewrite/ • mod_rewrite Cheat Sheet
 http://www.addedbytes.com/cheat-sheets/mod_rewrite-cheat-sheet/ • Stupid htaccess Tricks
 http://perishablepress.com/stupid-htaccess-tricks/
 All rights reserved © Café Noir Design Inc., 2014.
  14. Shannon Smith Web Developer Café Noir Design ! ! www.cafenoirdesign.com

    @cafenoirdesign All rights reserved © Café Noir Design Inc., 2014.