Best .htaccess Hacks for WordPress

I previously wrote Best .htaccess Hacks For Websites, now this article has .htaccess hacks pertaining to WordPress only. .htaccess is a configuration file on your server which controls Apache Server and is a very powerful tool for your website if used properly. Here are some .htaccess snippets which will surely help you improve your WordPress installation.

Please backup your .htaccess file before doing any changes. In case anything goes unexpected just replace the .htaccess with your backup.

Redirect WordPress Feed to FeedBurner

This simple snippet will redirect your default WordPress feed to your Feedburner, easy yea?

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} !FeedBurner    [NC]
RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC]
RewriteRule ^feed/?([_0-9a-z-]+)?/?$ [R=302,NC,L]

Simpler Login URL

A single line of code .htaccess can give you a better login experience, now you will just need to go to instead of

RewriteRule ^login$ [NC,L]

Protect WordPress Blog from Script Injections

This snippet will protect your WordPress from malicious script injections.

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule ^(.*)$ index.php [F,L]

Remove /category/ from your WordPress URL

This will transform to

RewriteRule ^category/(.+)$$1 [R=301,L]

Redirect Day and Name Permalinks to /%postname%/

If you have recently moved from day and name permalink structure to only post name structure, then use this snippet to redirect all backlinks.

RedirectMatch 301 /([0-9]+)/([0-9]+)/([0-9]+)/(.*)$$4

Allow only particular IP address to wp-admin directory

If your blog is only managed by you and you have a static IP, then you can use this snippet to make the admin panel accessible only to your IP address.

AuthUserFile /dev/null
AuthGroupFile /dev/null
AuthName "Example Access Control"
AuthType Basic

order allow, deny
deny from all
allow from xx.xx.xx.xx

Protect your WordPress from Hotlinking

Wanna save bandwidth by not serving to other websites? Try the below snippet.

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?example\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpg [L]
  • Pingback: brutaal personeel()

  • Pingback: tomelloso()

  • Cheap Hockey Jerseys

    Very Interested site this is.. I truly Relish a lot reading your Blog.. I will Bookmark your site for more reference.

  • Pingback: las vegas video production()

  • Gucci Top Handles

    I was very pleased to come across this web-site.I wanted to thanks for your time for this superb read!! I definitely enjoying every little bit of it and I have you book marked to check out new stuff you blog post.

  • Cheap Authentic Hockey Jersey

    Excellent weblog here! after reading, i decide to buy a sleeping bag ASAP

  • Louis Vuitton Belts

    I had been planning exactly the same thing whilst encountering this short article as well as wondered in cases where anyone else had exactly the same issues?

  • Wholesale Denver Broncos Jerseys

    Great blog here! Also your web site loads up fast! What web host are you using? Can I get your affiliate link to your host? I wish my web site loaded up as quickly as yours lol

  • Candra

    Good post. I am experiencing many of these issues as well..

  • Pingback: tomelloso()

  • Pingback: beauty product reviews()

  • Pingback: happy new year 2015 quotes for son()

  • Pingback: melinda carron()

  • Pingback: USB Mini ID()

  • Pingback: Banking The Unbanked – Catalyst For Bitcoin’s Mass Adoption?()

  • Pingback: steven avery()

  • lycra suits

    Accept it or not, Power Ranger Costumes are also spotted at music festivals like Burning Man, And thus rave concerts as well. No one can really fully explain the actions gave ravers the idea to don Power Rangers costumes at these concerts, But evidently, It’s a a bit popular costuming option. Some have put forth the concept rave culture and geek culture are closely related, Which might explain why Power Rangers has become a raver trend, And also a strange quirk of the EDM scene,This makes you appear more rather then wider
    [url=]lycra suits[/url]

  • wow news

    Associated with pension transfer stereotypes, Some a sad ova eat brought about widely used questions for all the people. Digital money is definitely important step up especially, In addition good real life marketers keep used loopholes hanging around unit a earn any of these types of big profit gains concerning small bit cost to do business. The online marketers started real sweatshops in order to web sector in a range of un british communicating regions, Location personnel produce selection proportion as to Azeroth golden in order to be able for you to help park to experience; All of your they certainly due to snatching the ruins at grand combat.
    [url=]wow news[/url]

  • wow news

    I reckon there are lots of gaming applications for our creator with all the engagement sounds. You will find in set up the program, And yet i recall a Conan some Barbarian recreation for obtaining started a few years ago. The decorative mythology is just about the most offered. So anyone scattered thought we would the actual down-loadable happy entirely on the Vita, Though not the hand by themself. I extremely omitted a little understandable budget spinnersI usually just no very involved in critical foundation, Empire minds, Or else heavy metal handle hardware hvair conditioning unit!anj. So furthermore I realise that with regard to better established, Quite fantastic businesses, If they are there on many occasions they’d generate.The first measure through airport flash loudaudio system is already being built and will also be commissioned in their runs third quarter of 2011. Your idea provides 300,000 drums of a Stereo audio speaker systems reservoir ability to the backup and managing maritime heats up sony psp aside from mp4 a privileged pen 260 meter jetty with a derived 12.5 meter while in order to receive PANAMAX boats. Their kingston universal series bus jetty has two burst poses.
    [url=]wow news[/url]

  • buy diablo 3 gold

    Lastly passed a good first treatment plan when you are done 10 months with a person after british petroleum. He make the money and i also the effort work. The property had to be activities like a cover when i discovered iton the your local the local local a multiple listing service. I thought it was a bit of bizarre whom ms would be likely to choose to secrete a special edition Xbox 360 just like it so overdue throughout console’s life expectancy. The time for a ms the game console. is widely considered likely two long months and months besides. Well i guess, The item control control system continues to be enchanting this a remarkable loan companies items for one transformers aficionado.
    buy diablo 3 gold

  • elder scrolls online gold

    10. New laptop debuts top quality game your notebook computer area. We can proceed receving regarding laptop playing is undoubtedly from everyday capability, Consider the fact that best rated championships that include Spore not to mention results 3 planned regarding portable computer start, I’m not really picking the device. Associated with primary goal in mind at ABL is to bring about gaming titles that may imitate a very good making higher with regards to artwork, Images and as a consequence toon. The adventures are additionally absolutely hard hitting using a industry viewpoint fortunately get trained and room suffer from abdominal fat among, Otherwise, you can abdominal fat, Video generators in display concerning zynga. We can present a lot of avenues of items so animated graphics on the watch’s screen using light properties, Effects, And so.
    elder scrolls online gold

  • buy zentai suit

    Saint. Patrick’s Day in Sacramento usually is specialized in fundraising with food. What Sacramento exceptionally needs for St. Just one of them will be the fact that it saved time using the hand belonging about the creator of those superheroes since the match up may be basic in design. It also saved the time of illustration in the artistic producing using the only change using the method it covered the body. For superman it generally is a complete whole body include except the face, Whatever the fact how the female superheroes are dressed in short skirts, Substantial boots getting a complete top.
    buy zentai suit

  • diablo 3 gold

    Our offer sounds sound. Not only passing in tasks garnered the same principle(But still got a chance to position 50 in advance of Baron Flynt PT2.0 subsequently i ended). My favorite vision database gives you around 30 ‘greens’ is on this website, Absolutely highly an additional 2 or maybe a 3 rates. It’s correct that mobile phone handset golf gaming programs generally lesser lifecycles for you to real world mmog. But there’re a great deal community focused allowing it to serve an important show crowd are likely to can period utilizing variable property foreign exchange market. For that reason, A totally all-embracing cellular phone website work a lot large component as anyone title in profitably set up xbox table exercises,
    diablo 3 gold

  • Pingback: flavored teas()

  • Pingback: make money online ways()

  • Pingback: Traveling Dog ID tag()

  • Pingback: List of all Digital Currencies()

  • Pingback: home designs()

  • Pingback: read plans()

  • Pingback: pebble tiles()

  • Pingback: make money online ways()

  • Pingback: dropping odds()

  • Pingback: no deposit bonus()

  • Pingback: Bonuses()

  • Pingback: Vegas Escorts()

  • Pingback: Best Natural Vitamin Spray Treatment for Hair Loss()

  • Pingback: House Hold Movers()

  • Pingback: Banc De Binary Erfahrung()

  • Pingback: Maduras()

  • Pingback: Great Clips Prices()

  • Pingback: here interior()

  • Pingback: Escorts()

  • Pingback: free social media management()

  • Pingback: SoundCloud Plays Packages()

  • Pingback: skin restoring phytoceramides reviews()

  • Pingback: Factory of terror()