Close Menu
My SiteMy Site
  • Home
  • Reviews
  • Computers
  • How Tos
  • Travel & Lifestyle
  • Phone ROMs
  • Contact
    • Advertise
    • About Us
Facebook X (Twitter) Instagram
My SiteMy Site
  • Home
  • Reviews
  • Computers
  • How Tos
  • Travel & Lifestyle
  • Phone ROMs
  • Contact
    • Advertise
    • About Us
My SiteMy Site
Home»Web Design Tips»Wordpress»10 Useful .htaccess Tricks to Improve Your WordPress Blog
Wordpress

10 Useful .htaccess Tricks to Improve Your WordPress Blog

Oscar FrankBy Oscar Frank4 Mins Read
Share
Facebook Twitter LinkedIn WhatsApp Pinterest Email

One thing I would always love about the .htaccess file in a website root directory is its ability to override configuration settings which includes server’s global configuration, content type and character set. With this in mind, it is simply possible to perform lots of functions on your wordpress blog using the .htacces files, functions such as securing your wordpress blog.

If up till now you do not know what the .htaccess file is, let me explain

What is a .htaccess file

According to Wikipedia, A .htaccess (hypertext access) file is a directory-level configuration file supported by several web servers, that allows for decentralized management of web server configuration. They are placed inside the web tree, and are able to override a subset of the server’s global configuration for the directory that they are in, and all sub-directories.

10 .htaccess tips to improve wordpress

Now you know a .htaccess file is, let’s move on to 10 tricks you can use the .haccess file to improve your wordpress blog.

How to Improve Your WordPress Blog Using .htaccess

  1. Redirect WordPress Feeds to Feedburner
    Do you want to redirect your WordPress Feeds to your Feedburner address, add this to your .htaccess file.


    # temp redirect wordpress content feeds to feedburner
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTP_USER_AGENT} !FeedBurner [NC]
    RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC]
    RewriteRule ^feed/?([_0-9a-z-]+)?/?$ http://feeds.feedburner.com/webanddesigners [R=302,NC,L]
    </IfModule>

  2. Block or Ban a Specific IP
    You can ban an IP using the .htaccess file, the list of IP’s should be changed to the one you wish to BAN


    <Limit GET POST PUT>
    order allow,deny
    allow from all
    deny from 123.456.789
    deny from 93.121.788
    deny from 223.956.789
    deny from 128.456.780
    </LIMIT>

  3. Deny access to your wp-config.php file
    You can block access from your wp-config.php file, it contains stuff like database username,name and password. Blocking it would help secure your blog.


    # protect wpconfig.php
    <files wp-config.php>
    order allow,deny
    deny from all
    </files>

  4. Redirect error to Customized 404, 403, 500 and other error pages
    You can create a customized error page such as 404 Error Page, 500 Error Page and other error pages. Simply create files in your root directory with designs for your Error Pages. For instance for 404 Error, create a 404.php design in your root directory and now add the below code to your .htaccess.


    # custom error pages
    ErrorDocument 401 /err/401.php
    ErrorDocument 403 /err/403.php
    ErrorDocument 404 /err/404.php
    ErrorDocument 500 /err/500.php

  5. Checkspelling
    Adding a Simple Auto Correct check spelling to your wordpress blog.


    <IfModule mod_speling.c>
    CheckSpelling On
    </IfModule>

  6. Allow only your IP on wp-admin
    If you do not run a multiple author blog and wish to allow only your IP to the wp-admin login page, then this is for you.


    AuthUserFile /dev/null
    AuthGroupFile /dev/null
    AuthName "Wordpress Admin Access Control"
    AuthType Basic
    <LIMIT GET>
    order deny,allow
    deny from all
    allow from xx.xx.xx.xx
    </LIMIT>

  7. Redirect www to non www or vice versa
    To redirect from www to non www use this


    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^www.yourblogname.com [NC]
    RewriteRule ^(.*)$ http://yourblogname.com/$1 [L,R=301]

    To redirect from non www to www use this


    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^yourblogname.com [NC]
    RewriteRule ^(.*)$ http://www.yourblogname.com/$1 [L,R=301]

  8. Redirect Day and name permalinks to /%postname%/
    Lets say you Moved from Blogger to wordpress, your sites post permalinks would have the date and year inclusive. You can use this .htaccess trick to redirect such permalinks to %postname% structure.


    RedirectMatch 301 /([0-9]+)/([0-9]+)/([0-9]+)/(.*)$ http://www.domain.com/$4

  9. Redirect visitors to a maintenance page
    Let’s say you are working on your blog and you wish to redirect your visitors to a Maintenance Page, here is what you need.


    RewriteEngine on
    RewriteCond %{REQUEST_URI} !/maintenance.html$
    RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123
    RewriteRule $ /maintenance.html [R=302,L]

  10. Secure Plugin Files
    There might be known loopholes in particular plugin unknown to, here is how to secure all your Plugin Files on wordpress.


    <Files ~ "\.(js|css)$">
    order allow,deny
    allow from all
    </Files>

Now you know the power of .htaccess file. Implement these wonderful tips at once. Remember, sharing is caring.

programming Wordpress

Related Posts

Common Mistakes Newbie Developers Make and Solutions

March 23, 2021

WordPress Blog Hosting made easy with SeekaHost Blog Hosting Control Panel

December 4, 2020

7 Best Laptops For Coders In 2025

February 28, 2020
View 16 Comments

16 Comments

  1. Admin @ Clixseo on February 9, 2013 12:36 am

    A True Prodigy, thanks for this wonderful article, i so much appreciate it.

    Reply
    • Oscar Frank on February 9, 2013 12:44 am

      You are welcome bro. Glad you found it a useful guide.

      Reply
  2. Guest Writer on February 9, 2013 12:48 am

    You won’t stop amazing us. Thanks for this blog security tips.

    Reply
    • Oscar Frank on February 9, 2013 12:49 am

      Anytime…

      Reply
  3. Kingsley on February 9, 2013 12:51 am

    Bro… Wont it cause server problem? I mean the secure plugin

    Reply
    • Oscar Frank on February 9, 2013 2:01 am

      It won’t. Unless you mess up with your .htaccess file. But it is usually recommended that you keep a backup of your .htacces file before editing it.

      Reply
  4. Adetony on February 9, 2013 1:37 am

    Thanks Oscar, you’re always known for teaching wonderful tutorial that can’t be gotten anywhere else. I’m still new on wordpress blog but I believe I can learn a lots from your blog. Come to think of it, I don’t really know much about .htacces but from what I just read on your blog now, I believe it will solve one of my problem which is my email subscribers could not get my new update. Thanks for doing what you know how to do

    Reply
    • Oscar Frank on February 9, 2013 2:02 am

      I’m glad it solved your blogging need, and you now know what the .htaccess file is all about.

      Reply
  5. Kingsley on February 9, 2013 8:02 am

    Ok… I will try them out.

    Reply
    • Oscar Frank on February 9, 2013 11:57 am

      That would be great bro.

      Reply
  6. lifeh on February 9, 2013 9:21 am

    wow nice share bro, it really helpful tanx

    Reply
    • Oscar Frank on February 9, 2013 11:59 am

      Glad you find it a useful resource.

      Reply
  7. Philip on February 9, 2013 6:30 pm

    Too gud oh

    Reply
    • Oscar Frank on February 10, 2013 1:11 am

      Thanks for coming by.

      Reply
  8. Kingsley on February 18, 2013 5:08 am

    Bro please where should we add this code in the .htaccess file? Below other codes or above?

    Reply
  9. Obama-Naija on September 23, 2014 9:13 am

    Where will i be posting the codes

    Reply
Leave A Reply Cancel Reply

Recent Posts
  • 6 Sports Apps You Must Have On Your Phone
  • Valencia Travel Guide: All You Need to Know About This Spanish Gem
  • TikTok Faces Unexpected Ban in Senegal, Sparks Global Curiosity
  • The Apple GPT & Apple’s Chatbot Mysterious Debut
  • Triller Takes on TikTok: Filing for Public Listing
Get Exclusive Tech Insights!
My Site
Facebook X (Twitter) Instagram YouTube
© 2025 Oscarmini Co. Designed by illBytes.

Type above and press Enter to search. Press Esc to cancel.