10 awesome .htaccess hacks for WordPress
.htaccess, the file which control the Apache webserver, is very useful and allows you to do a lot of things. In this article, let’s see how .htaccess can help you with your WordPress blog, for both security,functionnality and usability.
Warning
When editing or modifying the .htaccess file of your WordPress blog, make sure to always have a backup that you can restore in case of something went wrong.
1 – Redirect WordPress RSS feeds to feedburner with .htaccess
Which blogger doesn’t use feedburner? Sure, feedburner is a very nice service, allowing you to know how many people suscribed to your rss feeds. The only problem is that you must edit your theme files to manually change the rss url. Happilly, there’s a nice hack, using .htaccess, which will make you save a lot of time!
Don’t forget to modify line 6 before applying this code!
# 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://feeds2.feedburner.com/catswhocode [R=302,NC,L]
</IfModule>
Source: How to redirect WordPress rss feeds to feedburner
2 – Remove /category/ from your WordPress url
By default, WordPress category permalinks are displayed that way:
http://www.catswhocode.com/blog/category/wordpress
As you can see, the category in the url is pretty useless. Here’s how to remove it:
First backup your .htaccess file. Then, open it and append the following line:
RewriteRule ^category/(.+)$ http://www.yourblog.com/$1 [R=301,L]
Once saved, your categories pages will be displayed like this:
http://www.catswhocode.com/blog/wordpress
Source: How to remove category from your WordPress url
3 – Using browser cache
A very good way to optimize your blog loading time is to force the use of the browser cache. This code will not improve your blog loading time directly, but it will save some work to the server by sending a 304 not modified status when the requested element haven’t been modified.
FileETag MTime Size
<ifmodule mod_expires.c>
<filesmatch "\.(jpg|gif|png|css|js)$">
ExpiresActive on
ExpiresDefault "access plus 1 year"
</filesmatch>
</ifmodule>
Source: Comment accelerer le temps de chargement de votre blog
4 – Compress static data
Do you know that it is possible to send compressed data to the visitors, which will be decompressed by the client? This code will definitely save you (and your visitor) bandwidth and reduce your pages weight.
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4.0[678] no-gzip BrowserMatch bMSIE !no-gzip !gzip-only-text/html
5 – Redirect Day and name permalinks to /%postname%/
The first thing to do is to login to your WordPress admin, go to Settings → Permalinks and select custom. Fill out the field with /%postname%/.
Your permalinks will now look like the ones on this blog:
http://www.yourblog.com/name-of-the-post
Now we got to redirect all backlinks using the old permalinks structure to the new permalink structure. To do so, you’ll have to edit the .htaccess file, located in WordPress root directory.
Paste the following line in your .htaccess:
RedirectMatch 301 /([0-9]+)/([0-9]+)/([0-9]+)/(.*)$ http://www.domain.com/$4
Allright! You just changed your permalinks structure without loosing any backlinks!
Source: Redirect day and name permalinks to postname
6 – How to: Deny comment posting to no referrer requests
Are you sick and tired about the daily amount of spam comments received? Sure, there’s akismet, but here’s a little .htaccess trick to prevent spammers posting on your blog. The fact is that most spammers uses bots comming from nowhere. This code will look for the referrer (the page from where the commentator come from) and will deny commenting if the commentator try to access the wp-comments-post.php file without directly comming from your blog.
Just change the line 4 and specify your blog url there.
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
RewriteCond %{HTTP_REFERER} !.*yourblog.com.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]
Source: How to deny comment posting to no referrer requests
7 – Redirect visitors to a maintenance page
When you’re upgrading your blog, or making theme/design changes, it isn’t a good idea to let people see your blog being tweaked, sometimes with design or code problems, or even worst, security gaps.
The solution is to design a nice “maintenance page” and temporarily redirect your visitors to that page until you finished the maintenance.
Replace maintenance.html (line 2) by the page you’d like to redirect your visitors, and the IP adress on line 3 by your own ip.
Note that a 302 redirection is used, to avoid search engines indexing the maintenance page instead of your real homepage!
RewriteEngine on
RewriteCond %{REQUEST_URI} !/maintenance.html$
RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123
RewriteRule $ /maintenance.html [R=302,L]
Source: Comment faire une page d’accueil pour les internautes
8 – Protect your WordPress blog from hotlinking
Hotlinking is the use of an image from one site into a web page belonging to another site. Many bloggers are hotlinked, and have their bandwidth used on another websites. This very helpful code will protect your WordPress blog from hotlinking.
RewriteEngine On
#Replace ?mysite\.com/ with your blog url
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
#Replace /images/nohotlink.jpg with your "don't hotlink" image url
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpg [L]
Source: How to protect your WordPress blog from hotlinking
9 – Allow only your IP adress on the wp-admin directory
Excepted the case of a collaborative blog, only you should be allowed to visit the wp-admin directory. If you have a static IP, this code will do the job.
All you have to do is to enter your static IP adress on line 8. Note that you can add more IPs if needed, by creating a new line with: allow from xx.xx.xxx.xx inside.
AuthUserFile /dev/null AuthGroupFile /dev/null AuthName "Example Access Control" AuthType Basic <LIMIT GET> order allow, deny deny from all allow from xx.xx.xx.xx </LIMIT>
Source: Protecting the WordPress wp-admin folder
10 – Banning a WordPress Spammer With .htaccess
You know it, spam is very annoying. In the case of a particular person/bot spamming you, you can easily avoid it by blacklisting the IP.
Simply replace the IP adress on line 3 by the spammer’s IP. You can add more spammers by creating a new line with deny from xxx.xx.xxx.xxx inside.
<Limit GET POST> order allow,deny deny from 200.49.176.139 allow from all </Limit>
8 – Protect your WordPress blog from hotlinking
It will be necessary to try necessarily, and that in manual each time to change names of files tires, at the same time and protection against theft of a content.
Thanks for the information
Very nice article. Just retweeted it.
10 awesome .htaccess hacks for WordPress…
10 Great Ways to add custom settings to WordPress and make it more useful, and more secure!…
Nice top 10, especially the “Deny comment posting to no referrer requests”. Thanks a lot !
Great Hacks! im liking the whole saving bandwidth thang – that can be a problem when you got a load of popular blogs on your poor lil’server!
some of these cab be done through plugins but all of them are still very usefull
Thank you for these useful tips.
[...] 10 hacks .htaccess pour WordPress [...]
Nice list of WP hacks. Thanks a lot !
This is a great list. You do a great job with your blog of really digging into deep aspects of developing a wordpress site and it really has helped me with my blog. I might try and change some of these things.
Great tips! I’m going to employ most of them, especially the wp-admin hack.
Already saved in my bookmarks, thanks a lot !
Just a question for #2 : deleting “category” could be negative for SEO or not ?
Yes, at least I find good info. Thanks
Very nice indeed! Thank you!
[...] 10 awesome .htaccess hacks for WordPress Some very useful tips here. (tags: wordpress) [...]
Hi,
Thanks for this article, it’s going to be really useful for me, in fact – essential! I’ve dugg this article.
In response to Comment #7, plugins are bloat. I’d prefer not to use plugins if possible.
A great article! Congrats jbj! That’s what I love to read! I am going to add it to wpvote right away!!
re: #8 (hotlinking), we had a competitor stealing our images. In such cases, the options are:
1) refuse foreign references, as this solution does
2) redirect to offensive image to hasten the takedown (immature, funny, but without goatcxe, lacking “oomph”)
3) redirect to an advertisement for our site
I opted for #3, I redirected to a lighter-weight image of the site to bring in more clicks. Also, considered swapping out my own reference to that image (only one local ref) and making a permanent redirect for the original reference, with the idea that the discussion plus the 301-redirect to my content actually improves SEO around that subject — the foreign hotlink costs me less bandwidth, but brings in traffic and SEO ranking
I love the idea of free advertising.
I will have to remember that little tip! Thanks.
@Alan Clark,
I like that solution. I must remember that one.
One slick and long list… stumbled it.
10 awesome .htaccess hacks for WordPress…
In this article, let’s see how .htaccess can help you with your WordPress blog, for both security,functionnality and usability….
Awesome post.. thanks man! just a quick question though. Where should I copy these codes and how can i find this file that you mentioned? Im trying to use the hotlinking code you posted here.
thanks again…
Tried the “Remove /category/ from your WordPress url” and it didn’t work. Should the code be placed in the .htaccess file in the blog/root folder or elsewhere?
I’ve always been sorta scared to touvh the htaccess file, but I realized its fine. Just to back it up.
Anyway, nice post, I like the one with feedburner, probably the most popular one.
superb post!! bookmarked and tweeted
But I particularly don’t like the first hack. it defeats the purpose of feed structure of WordPress.
[...] http://www.catswhocode.com/blog/10-awesome-htaccess-hacks-for-wordpress [...]
[...] 对于ApacheæœåŠ¡å™¨ï¼Œä½¿ç”¨.htaccess文件å¯ä»¥è¿›è¡Œå¾ˆå¤šç›¸å…³ç½‘络æœåŠ¡è®¿é—®çš„é…置。而以下的10个技巧则专门针对WordPress所进行的设置,推è大家å‚考使用: å‚考原文:10 awesome .htaccess hacks for WordPress [...]
Great post very informative. Imma wimp when it comes to messing with the .htaccess but I’v learnt somethings which am gona impelent. Thanks for the advice n tips.
awesome!
i found in my htacess old code and remove this… and now is my blog faster then before. Thx for this article!
[...] diese Tipps und Tricks hier, hab ich nach langem mal wieder reingeschaut und den Schrott [...]
“i found in my htacess old code and remove this… and now is my blog faster then before.” It’s the same to me! Thx!!
[...] 10 awesome .htaccess hacks for WordPress Braiga inställningar till din WP-blogg. (tags: worpress apache htaccess tips) [...]
[...] 10 awesome .htaccess hacks for WordPress [...]
Your tipps are extremly helpful to secure/setup my own wordpress blog. Thanx a lot!
[...] 10 awesome .htaccess hacks for WordPress (tags: wordpress hacks htaccess) This entry was posted in Delicious. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL. « links for 2009-03-19 [...]
10 awesome .htaccess hacks for WordPress…
通过 Apache çš„ .htaccess 实现:é‡å®šå‘ Feed 地å€ï¼ŒåŽ»é™¤åˆ†ç±»é“¾æŽ¥ä¸çš„ /category/,æµè§ˆå™¨ç¼“å˜ï¼ŒåŽ‹ç¼©é™æ€æ•°æ®ï¼Œé‡å®šå‘æ—¥æœŸæ ¼å¼çš„链接地å€ä¸º postname æ ¼å¼ï¼Œé˜»æ¢æ²¡æœ‰ referrer æ¥æºé“¾æŽ¥çš„垃圾评论,定….
@ Allan i think i am going to do the same thing and show an ad for my site.
Great list of tips and tricks i am defiantly going to implement a few of them.
[...] aici. Tags: spam, [...]
Nice collection of tips. Still, have you tried #4 yourself? It seems not to work (checked with YSlow), components still aren’t gziped.
As for #6, unfortunately, it’s really easy to set the referrer and user agent, from any server-side script, loads of bots are that advanced. Did you notice any improvement with it?
Cheers.
[...] å‚考原文:10 awesome .htaccess hacks for WordPress [...]
10 awesome .htaccess hacks for WordPress…
.htaccess, the file which control the Apache webserver, is very useful and allows you to do a lot of things. In this article, let’s see how .htaccess can help you with your WordPress blog, for both security,functionnality and usability….
[...] 10 awesome .htaccess hacks for WordPress [...]
@ Maigret – removing category won’t matter unless you want to rank for that word
Re #3 – is this required if you’re using the WP Super Cache plugin? It seems to do client side caching as well as server side. Not sure though.
[...] 10 awesome .htaccess hacks for WordPress [...]
[...] Read full story here: 10 awesome .htaccess hacks for WordPress [...]
[...] 对于ApacheæœåŠ¡å™¨ï¼Œä½¿ç”¨.htaccess文件å…许WordPressçš„åšå®¢åšå¾ˆå¤šäº‹ 安全,功能 å’Œå¯ç”¨æ€§ã€‚ å‚考原文:10 awesome .htaccess hacks for WordPress [...]
[...] 10 awesome .htaccess hacks for WordPress – Warning When editing or modifying the .htaccess file of your WordPress blog, make sure to always have a backup that you can restore in case … [...]
[...] 10 awesome .htaccess hacks for WordPress – Cats Who Code [...]
[...] å‚考原文:10 awesome .htaccess hacks for WordPress [...]
[...] 10 awesome .htaccess hacks for WordPress [...]
[...] 22. März 2009 Kommentare Einen Kommentar schreiben Angeregt durch die Tipps bei catswhocode.com habe ich eben die Permalinkstruktur meiner Postings umgebaut und entsprechende .htaccess-Regeln [...]
Wow, what a great and detailed guide, very helpful, just subscribed, thanks!
[...] Cum să scapi de spam 23 03 2009 Adăugaţi liniile următoare în fişierul .htaccess, şi veţi scăpa de spam, cel puţin aşa zice aici. [...]
[...] Cats Who Code has a great list of ten .htaccess hacks that will do interesting things. From redirecting your RSS feed to Feedburner, to banning spammers from your blog, .htaccess can be a powerful ally in making your blog the envy of the blogosphere. [...]
What more can I say? Seriously impressed with this post. Thanks.
Good Info, I’am try on my blog
Thanks for the wonderful list.
Nice list of .htaccess codes I think many WordPress (and other) users will like.
Stumbled your article. Thanks.
Very useful, thanks!
Emanuele
[...] 10 trucos .htaccess (es)| Fuente: Cats who code [...]
[...] reúne una interesante colección de 10 trucos de .htaccess para WordPress con los que puedes modificar el comportamiento del servidor web Apache, y a la vez mejorar la [...]
Another great tutorial. Thanks.
Excellent wordpress hacks collection. I think everyone should at least implement those security hacks, as you never know when your blog will come on hacker’s mind.
I am assuming that you need %/category/% in your permalink structure active in order to the RewriteRule to function?
[...] Cats Who Code has a great list of ten .htaccess hacks that will do interesting things. From redirecting your RSS feed to Feedburner, to banning spammers from your blog, .htaccess can be a powerful ally in making your blog the envy of the blogosphere. [...]
This is a very solid article. Its utilization to redirect wordpress rss feeds to feedburner is genius. I also like the idea of using .htaccess to ban spammers. That definitely is going to come in handy!
Super Article!
On our site we have comments turned off, however in a dashboard you can still see the huge list of spams trying to get in via wp-comments-form.php and mostly from auto insurance sites, since we’re in that business. Hopefully we put the stop on that.
Thank you so much, I already add the lines to my .httacess,
Emil
Great collection of .htaccess hacks. Hacks about restricting all to wp-admin dir and preventing hot linking is very useful.
Excellent article. I was not aware you could do so much in the .htaccess file. I build wordpress sites almost exclusively. Good to know now how much flexibility I have in the .htaccess file.
Thanks.
I think there is allready a plugin to redirect standard rss feed to Feedburner rss feed.
Yeah but why would you ever want to use a plugin when there is no need.
Plugins increase load time of your site and also pose possible security issues to your blog. Last week, someone tried to hack our blog using a security hole in the wp-adverts plugin. We don’t use that plugin, however.
Whenever you can do something without a plugin, especially if it’s through .htaccess, that’s the way to do it.
Excellent collection, already tweeted/sent this to everyone I know.
Re: 2) there is some value to your categories being identified as such to Google, same for Tags if you use them (which I hope you do, ideally with SimpleTags plugin which rules over WordPress’ native tag handling).
Re: 5) nice trick, of course one should set this up in the way you describe from the beginning…
Re: 6) I’ve found the YAWASP Plugin to catch 99% of spam via a very simple yet genius method that doesn’t require captchas and doesn’t have the overreach problems that Akismet has (I have Akismet turned off in fact).
Looks you’ve done a great job on .htaccess. I’d like to warn everyone – try it first before you put in on online server. Or backup your previous copy if you’re not 100% sure what you’re doing.
#6 is awesome! I was wondering how I could possibly stop all the spambot comments easier. I never even thought about the .htaccess file. Duh. Great bit of code. Mucho thanko.
[...] read the .htaccess tweaks in full click here Subscribe To RSS Feed Updates (What is [...]
Bookmarked! This post was a life saver for getting your blog running well on wordpress. I really liked the redirect feedburner.
Yeah I agree. Why use a plugin when everything you need can be found here (or with a quick google search).
Who needs plugins? You may start to disable some of it and make sa .htaccess tweaks which really comes in handy. Well, How I wish (again) I can do this for blogger platforms.
this is a great tutorial. very useful information.
many thanks to you
[...] [...]
I hadn’t even put two and two together on the rss feeds. Way to make the most out of it by redirecting to feed burner. This was a great list and I appreciate the suggestions. I hope to see some more soon!
Wow.. great!!.. thansk for sharing.
In regards to the feedburner hack do you just replace the http://feeds2.feedburner.com/catswhocode portion with our own code?
Thanks for the hacks. With regard to #7, can I use it redirect to another site (e.g. http://abc.com and how should I rewrite the code below
RewriteCond %{REQUEST_URI} !/maintenance.html$
Is this correct?
RewriteCond %{REQUEST_URI} !abc.com$
Thanks for this nice tricks! Especially for the deny comments and hotlinking one!
re #1 – there’s a plugin for that, which lets you avoid mucking around with (and potentially screwing up) your .htaccess.
Mezanul
Just remember though, if you stop hotlinking to images on your site you may be denying people a way to find your site. I get traffic from people searching Google and Yahoo Images.
Toronto Plastic Surgeon
See my previous comment. Plugins can slow down the load time of your blog and also provide possible security holes. I’ve been on the WP forums for awhile and there are a number of people’s blogs which have been hacked due to security issues with some plugins.
.htaccess is always the best way to do things. It’s read before your website is even visited.
#1 would have helped everyone switch their feeds over to the new feeds2 URLs
yeah, i agree with John Hoff. sometimes hotlinked image can drive me some traffics. I don’t care about bandwidth because i host my files in Google (blogspot)
Thanks. Modifying the htaccess file can be quite challenging. The tips are really useful and I can see right away that I can use a number of them on my blogs.
Nice list of WP hacks. Thanks a lot !
Fantastic! The category removal from the directories has stumped me. This question might get me railed but it is possible to have an htaccess file in multiple directories on the site correct? I have only use WP for stand alone installations, not to hang on a website.
I think some of these hacks are not required. They can be done straight from the settings panel. One hack which I know can be done from settings is hack # 2. It can be done from the permalink structure settings from inside wp-admin.
I want to add my own ModRewrite Rule in wordpress blog. Then what should i do ??
You can also answer me on niazi587 at gmail dot come
Very useful article. Thanks for sharing.
I’am planning to have my own site.. thanks for this idea. really helps me a lot. I know more blogger are been helped by this topic.
I just tried the remove /category/ from the URL.
RewriteRule ^category/(.+)$ http://www.yourblog.com/$1 [R=301,L] on my blog.
It works, but when you get to any categories, it won’t let me access pages, like /page/2/ without getting a 404 error.
It appears that I need something to handle the pages.Any suggestion how to handle the following, /page/*/
[...] 10 awesome .htaccess hacks for WordPress [...]
i already know all this tips. Just beaware of tip number 8 . In fact, you might get penalized by Google. I also think there could be some issue when Google Images try to display your blog pitures in its results…
[...] 10 awesome .htaccess hacks for WordPress [...]
Finally a clear article about htaccess tips !
2 questions though : is there an easy way to set up a password at the homepage (and the whole blog) ?
My default htaccess is like this :
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Where should I insert the code you provide ? Anywhere between the two “#” tags?
thx
Yeah blocking bots is a great way to save a lot of time on comment moderation. Plus you know you won’t miss out on anything important since there hasn’t been one instance in the history that the bot would make a wirthwile comment.
Emal
You can put it above as the very first item (above the first #) or below the last #, either way will work.
All the # are, are comments.
If you’re not familiar with .htaccess, then the easiest way to password protect either a directory or your entire site (i.e. password protect your root) is to set up password protection through your web hosting control panel. Log into your control panel and look for an icon or something name “Password Protect”.
[...] 10 awesome .htaccess hacks for WordPress [...]
Thanks for sharing
[...] 10 awesome .htaccess hacks for WordPress [...]
[...] 10 awesome .htaccess hacks for WordPress [...]
Thank you very much for this awesom htaccess hacks. I have used 2-3 from the list. WIll try using the rest of them.
Thanks for the wordpress hack list – this will help me setting up things I wanted to.
How does the security with those hacks look?
These are definitely some great .htaccess tricks. I have actually used a few of these myself. Another resource that I thoroughly enjoy when it comes to .htaccess tricks is at http://perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/. You can find a ton of different .htaccess stuff there, from optimization to security.
awesome tips, thanks a lot.
you can do the same thing with categories in the permalink sections by using “/.” but it does throw out ome issues with pagination (does the htaccess change work with pagination?)
protecting from hotlinking images is really great.
great post!
Awesome stuff, thanks
i already know all this tips. Just beaware of tip number 8 . In fact, you might get penalized by Google. I also think there could be some issue when Google Images try to display your blog pitures in its result
[...] 10 awesome .htaccess hacks for WordPress [...]
Just like the user before me mentioned, there’s no such a thing as hacking into your email account using nothing more than your email address. Unless it’s an inside job. Whatever you are using for blog.
[...] http://www.catswhocode.com/blog/10-awesome-htaccess-hacks-for-WordPress [...]
Good tips. I only used this in the past to restrict folder access.
#7 sorted me out! I was using a dodgy plugin that was doing some crazy stuff to my website and yet adding a maintenance page is soooo easy!
Thanks.
Hey, some good stuff here, I lost 2 hours trying to work out some stuff, found this page and it took me 5 minutes!
Nice blog too, keep up the good work.
Thanks much for those awesome tips
Hi,
Previously I was using a plugin called “Top Level Cats†to remove “category” from url. When I tried to upgrade WP to the latest version, that plugin started giving problem.
Thanks to your tip, I have now upgraded to WP 2.7.1 and everything is working perfect. Thank you so much.
that category hack has saved my ass. However now have to wait for Google to reindex the new pages :S
Thanks for the great htaccess tips
Hi!, I can´t upload the .htaccess file…
553 Can’t open that file: Permission denied
Error: Critical Error
8 and 9 were worth the click alone. thanks.
Yes! The answers I’ve been looking for, I can’t sleep again! thankyou
[...] Fjern tilgang til mappestrukturen din. Hvis du kjenner til .htaccess, sjekk ut denne innføringen i hvordan beskytte WordPress best mulig med .htaccess. Sjekk også denne siden. [...]
The tip #8 is is awesome, but I am wondering about the following… besides having ftp access to the server, I only have the Google Analytics stats, I am wondering.. how do you find out without blocking them first, who is using your images, and content? I would much rather see who is using it, as opposed to blocking them first, hehe.
-Randy
Yes! The answers I’ve been looking for, I can’t sleep again! thankyou
[...] ein WordPress Hack in der .htaccess im neuen WordPress Verzeichnis brachte die [...]
There are many addons that can do these things, but I still believe using .htaccess is still the best and ONLY way to do these.
[...] http://www.catswhocode.com/blog/10-awesome-htaccess-hacks-for-wordpress [...]
[...] CatsWhoCode.com : Comment s’amuser avec les fichiers .htaccess ? sur cette page 10 astuces sur ces fichiers magiques ! [...]
Thank you very much for this awesom htaccess hacks
[...] 10 awesome .htaccess hacks for WordPress [...]
[...] 2. Hack your .htaccess [...]
Thanks for the great info on this post. I just found out about the htaccess file, but I didn’t realize you could do so much with it.
[...] 英文原稿:10 awesome .htaccess hacks for WordPress | CatsWhoCode 翻译整ç†ï¼šWordPress çš„ 10 个 .htaccess 技巧 | 芒果 [...]
Very useful tips
.. keep them coming…
Hey Jean-Baptiste,
Just want to say thank you. My stuff drove me nuts with .htaccess. Please keep it up.
Once again thanks,
Jon
Great tips, just re-tweeted this post. In particular, #4, #8 and #9 are what I need to do today!
Thanks again,
Jules
[...] This article is the best source for .htaccess improvements. This is for advanced users only. [...]
[...] 10 awesome .htaccess hacks for WordPress AKPC_IDS += “302,”;Popularity: unranked [?] WordPress ã‚¿ã‚°: [...]
[...] I’m posting this here for my own reference and for others that may find them usefull, via CatsWhoCode [...]
[...] 本文转自:10 awesome .htaccess hacks for WordPress 分类: 网络应用 æ ‡ç¾: WordPress 评论 (0) Trackbacks (0) å‘表评论 Trackback [...]
[...] 阅读全文:10 awesome .htaccess hacks for WordPress [...]
Wow! Jean, Thank you so much for sharing. Found two tricks listed here which I have been looking everywhere for. -Tom
[...] 10 awesome .htaccess hacks for WordPress htaccess, the file which control the Apache webserver, is very useful and allows you to do a lot of things. In this article, let’s see how .htaccess can help you with your WordPress blog, for both security,functionnality and usability. (tags: wordpress tips) [...]
[...] 10 awesome .htaccess hacks for WordPress .htaccess, the file which control the Apache webserver, is very useful and allows you to do a lot of things. In this article, let’s see how .htaccess can help you with your WordPress blog, for both security,functionnality and usability. (tags: blog web tools webdesign wordpress blogging tutorial tips resource security howto hack examples mod_rewrite resources hacks webdev articles code wp .htaccess htaccess tutorials development php worpress webserver apache wordpress-hacks access) [...]
[...] Source – CatsWhoCode/Woueb.net [...]
[...] 10 awesome .htaccess hacks for WordPress [...]
Thanks for the great tips/tricks in htaccess that we all need it.
only facing one problem after using couple steps in here.
all my urls ending with (.htm) is there is any htaccess rule/tip to remove that and just get clean url?
thanks again
[...] å‚考原文:10 awesome .htaccess hacks for WordPress [...]
[...] æ¥æº – CatsWhoCode/Woueb.net [...]
[...] æ¥æº – CatsWhoCode/Woueb.net [...]
[...] heros or cartoon characters, get used to it). Last night I was fooling around with some WordPress htaccess hacks, and apparently the Apache webserver did not enjoy what I was doing. This morning her memory [...]
hi
i need your help i am new to wordpress my questions are
1. is it possible to publish the posts in different directories like if i post it shows
“www.example.com/your-post” i want to publish the post like “www.example.com/computers/your-post”
and “www.example.com/internet/your-post”
2. i install wordpress and i change the permalink settings from “default” to “month and name” and after saving it says “You should update your .htaccess now” but i don’t know where it is and what to update in it.
i have publish no any posts
Please help
[...] å‚考原文:10 awesome .htaccess hacks for WordPress [...]
[...] 注æ„ï¼šä»¥ä¸‹æ–‡ç« ç¿»è¯‘æ¥è‡ªè‹±æ–‡ç½‘站:10 awesome .htaccess hacks for WordPress .htaccessæ–‡ä»¶æ˜¯ç”¨æ¥æŽ§åˆ¶ApacheæœåŠ¡å™¨çš„ï¼Œå®ƒå¾ˆæœ‰ç”¨ï¼Œå¹¶å…è®¸ä½ åšå¾ˆå¤šäº‹ï¼Œä¸‹é¢å°±ä»‹ç»å…³äºŽ.htaccessçš„10ä¸ªä¿®æ”¹æ–¹æ³•ï¼Œè®©ä½ çš„wordpressæ›´åŠ çš„å®‰å…¨ã€å¤šåŠŸèƒ½ã€å’Œå¯ç”¨æ€§ï¼ è¦å‘Šï¼šåœ¨ä¿®æ”¹ä¹‹å‰è¯·ä½ 备份.htaccess,一边修改åŽå‡ºçŽ°é”™è¯¯ä½ å¯ä»¥æ¢å¤ï¼ 1.é‡å®šå‘ä½ çš„WordPress RSS feeds 到feedburner或feedsky # 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://在feedburnerä½ çš„åœ°å€ [R=302,NC,L] </IfModule> [...]
hi..
i am new to wp. if i want to use all the .htaccess hacks, can anyone show me how to write all the .htaccess hacks in just one .htaccess file?
That’s pretty cool!!
[...] 10 awesome .htaccess hacks for WordPress [...]
[...] 15. 10 awesome .htaccess hacks for WordPress [...]
[...] 10 awesome .htaccess hacks for WordPress [...]
[...] 10 awesome .htaccess hacks for wordpress [...]
[...] 英文原文: 10 awesome .htaccess hacks for WordPress [...]
Great post,
I really dont know about .htaccess file, but thanks for posting.
[...] the golden rule of .htaccess – always have a backup. Further .htaccess reading is available here on CatsWhoCode and my own blog, [...]
[...] the golden rule of .htaccess – always have a backup. Further .htaccess reading is available here on CatsWhoCode and my own blog, [...]
Nice list. Really like the protecting your wp-admin directory to a single ip. Bookmarked!
[...]   对于ApacheæœåŠ¡å™¨ï¼Œä½¿ç”¨.htaccess文件å¯ä»¥è¿›è¡Œå¾ˆå¤šç›¸å…³ç½‘络æœåŠ¡è®¿é—®çš„é…置。而以下的10个技巧则专门针对WordPress所进行的设置,推è大家å‚考使用:   å‚考原文:10 awesome .htaccess hacks for WordPress [...]
2 questions though : is there an easy way to set up a password at the homepage (and the whole blog) ?
[...] 10 awesome .htaccess hacks for WordPress [...]
[...] 10 awesome .htaccess hacks for WordPress [...]
@ sikiÅŸ – The easiest way to do that if you’re not familiar with .htaccess rules is to simply set up a password protection system through your web hosting control panel.
Most all hosting companies provide this service. Just a few clicks and you can password protect any directory, including your root.
Hey Jean, good list of hacks all put together in a nice and easy way. I wasn’t aware that you could utilize .htaccess file so effectively.
[...] the golden rule of .htaccess – always have a backup. Further .htaccess reading is available here on CatsWhoCode and my own blog, [...]
[...] Jean-Baptiste tells us about 10 awesome .htaccess hacks for your WordPress blog including the ability to redirect visitors to a maintenance page while you can continue to see and work on your blog. Liknande inlägg:Wordpress i facebook och facebook till wordpressAll In One SEO Lives OnIntressant hemsida om klimatmärkningComment License Made EasyWordPress Plugin Releases for 11/13 Tipsa andra [...]
[...] the golden rule of .htaccess – always have a backup. Further .htaccess reading is available here on CatsWhoCode and my own blog, [...]
hi..
i am new to wp. if i want to use all the .htaccess hacks, can anyone show me how to write all the .htaccess hacks in just one .htaccess file?
[...] 10 awesome .htaccess hacks for WordPress [...]
[...] 10 awesome .htaccess hacks for WordPress [...]
Some great tips. Thanks for sharing
Very nice article, thanks for sharing.
[...] the golden rule of .htaccess – always have a backup. Further .htaccess reading is available here on CatsWhoCode and my own blog, [...]
Many thanks for the resources. I find tip #3 – Using Browser Cache particularly useful.
2 questions though : is there an easy way to set up a password at the homepage
[...] 10 awesome .htaccess hacks for WordPress [...]
Hi there Jean,
What if I want to change this:
…link rel=”stylesheet” href=”http://mydomain.com/wp-content/themes/xmnt/style.css” type=…
to
…link rel=”stylesheet” href=”/xmnt/style.css” type=…
I want to hide the root address…Can .htaccess execute like that?
If can, can You give me some example how to do it. tnx
I want to hide the root address…Can .htaccess execute like that?
If can, can You give me some example how to do it. tnx
If you have an established blog already, what are the negatives of switching to postname from year/month/day/postname?
[...] 10 awesome .htaccess hacks for WordPress [...]
[...] the golden rule of .htaccess – always have a backup. Further .htaccess reading is available here on CatsWhoCode and my own blog, [...]
[...] 对于ApacheæœåŠ¡å™¨ï¼Œä½¿ç”¨.htaccess文件å¯ä»¥è¿›è¡Œå¾ˆå¤šç›¸å…³ç½‘络æœåŠ¡è®¿é—®çš„é…置。而以下的10个技巧则专门针对WordPress所进行的设置,推è大家å‚考使用: å‚考原文:10 awesome .htaccess hacks for WordPress [...]
Hi Jean,
I am having problem with WP blog, after upgrade to IE8
The posts/pages can only opened if the permalinks are set in default.
Others, will show “The webpage cannot be found” HTTP404
How to solve? Please
Good day,
I’m new to WordPress and I’m trying to add permalinks so my posts are searchable. Problem – I can’t find .htaccess to open and edit it as per wp-admin instructions. If I try and create a new file .htaccess it tells me it is already there. Is it hidden? It’s probably simple but something is escaping me!!! HELP!
[...] Source:Cats who code Submit this to Script & StyleDigg this!Stumble upon something good? Share it on StumbleUponShare this on del.icio.usTweet This!Share this on FacebookShare this on TechnoratiShare this on MixxEmail this to a friend?Buzz up!Share this on RedditPost this to MySpaceAdd this to Google BookmarksSubmit this to TwittleyMoo this on DesignMoo!Submit this to NetvibesShare this on Blogosphere NewsRelated Posts :Two awesome Farmville (Facebook) cheats! [...]
[...] 10 awesome .htaccess hacks for WordPress – .htaccess, the file which control the Apache webserver, is very useful and allows you to do a lot of things. In this article, lets see how .htaccess can help you with your WordPress blog, for both security,functionnality and usability. – wordpress htaccess tips blog tutorial « Meine Bookmarks vom November 21st bis November 22nd [...]
Hello, thanks for the post, I have a question.
When I insert this code to zen-cart .htaccess:
redirect 301 /odd.html http://www.odddomain.com/new.html
it did redirect to the new.html, but zencart add certain parameters to the end of the new url which resulted in the show up of the odd.html content while the url is new.html.
Please help, thanks.
The better way to protect your wp-admin folder with this code
Order Allow,Deny
Deny from all
Allow from all
allow from xx.xx.xx.xx
This way when users login they do just see a plain jain ugly page and they get the css loog of the wordpress login.
[...] 对于ApacheæœåŠ¡å™¨ï¼Œä½¿ç”¨.htaccess文件å¯ä»¥è¿›è¡Œå¾ˆå¤šç›¸å…³ç½‘络æœåŠ¡è®¿é—®çš„é…置。而以下的10个技巧则专门针对WordPress所进行的设置,推è大家å‚考使用: å‚考原文:10 awesome .htaccess hacks for WordPress [...]
[...] 10 Awesome .htaccess Hacks for WordPress – A great collection of .htaccess hacks, including removing/category/ from your WP URLs and how to redirect visitors to a maintenance page. [...]
[...] 对于ApacheæœåŠ¡å™¨ï¼Œä½¿ç”¨.htaccess文件å¯ä»¥è¿›è¡Œå¾ˆå¤šç›¸å…³ç½‘络æœåŠ¡è®¿é—®çš„é…置。而以下的10个技巧则专门针对WordPress所进行的设置,推è大家å‚考使用: å‚考原文:10 awesome .htaccess hacks for WordPress译文出自:http://e-spacy.com/blog/10-htaccess-hacks-for-wordpress.html [...]
Some great tips thanks for sharing with us.
Very helpful tips. Don’t forget 644 to all files, you can be hacked easyly
[...] 15. 10 awesome .htaccess hacks for WordPress [...]
These really came handy…. kudos!
Indeed Valuable. Thanks for the share
Great post! Quite a few things to use .htaccess for.
@Alan Clark: Like your developed suggestion for #8 hotlinking.
Great post! And yes…backing up your code before you start editing, can’t emphasize enough!
[...] 10 .htaccess Tipps für WordPress [...]
very informative post…. But we should always be careful with .htaccess file.. messed up the whole site once!!!
[...] via: 10 awesome .htaccess hacks for WordPress [...]
[...] 10 Awesome. Hacks htaccess para WordPress – Una gran colección de. Hacks htaccess, incluyendo la eliminación / categoría / URL de tu WP y cómo redirigir los visitantes a una página de mantenimiento. Sin Respuestas to “WordPress – Themes – Plugins” [...]
[...] from all</Limit>参考:The easiest way to ban a WordPress spammer 英文原文: 10 awesome .htaccess hacks for WordPress 中文译文: 10个WordPress的.htaccess技巧 标签: WordPress, WordPress技巧 作者: paran [...]
In Hack 9 it’s not deny,allow it’s allow,deny. If incomming doesn’t match the deny nor allow condition set then the second is followed as allow all if you have deny,allow and deny all if you have allow,deny.
@Robert – Your reply almost gave me a headache! LOL
but thanks for the tip on HACK #9
Tip #9 is still not fixed. It cannot be in the root, or you will deny access to all but your own IP. It must go in wp-admin/
I am currently using the following permalink structure and am looking to change it through a 301 redirect but cannot find the code that works.
Currently permalink: /%year%/%monthnum%/%postname%.html
Future permalink: /%postname%
Can someone help me?
thanks verry much bro for this information, but i need an regex for the baning ip for spammer that like
if visitor come without reff then go ban it
if user agent come then ban go ban it
but if visitor or user agent comes withboth of two list ( the reff and/real user agents name )its must 200
sorry im still newb ^^ i want to learn please let me know how to to this
but if i got thats way i will tell you too
regards
santosamaru
[...] the golden rule of .htaccess – always have a backup. Further .htaccess reading is available here on CatsWhoCode and my own blog, [...]
Social comments and analytics for this post…
This post was mentioned on Twitter by alaksir: Useful reference for you web geeks: 10 awesome .htaccess hacks for WordPress http://bit.ly/1V9pNY…
Wow impressive article!
Recently, I’ve created a new subdomain (the domain has a wordpress blog on it) and I’ve uploaded some avi files there. I’ve created then an html file with links pointing to these movies.
The problem is I cannot access these files when I click on the links. Is giving me that message with “Nothing found for …”.
I guess is related to .htaccess file or / and somehow to wordpress since I did the same thing on another domain with no worpdress on it and it works. Any ideas why this problem?
Thanks!
[...] Once you’ve added these lines, save it and remove the .txt file extesion, then upload it to the root directory of your WordPress installation. There are plenty more hacks you can include in your .htaccess file. Have a look at this article if you want more information: 10 Awesome .htaccess Hacks for WordPress. [...]
thanks! i’m new to wordpress and this is just what i’ve been looking for. good luck!
[...] 10 awesome .htaccess hacks for WordPress [...]
[...] the golden rule of .htaccess – always have a backup. Further .htaccess reading is available here on CatsWhoCode and my own blog, [...]
Thanks
It’s work like a thunder!
I try my self with trick number 3 & 4..
Now my blog load like dedicated sever!
[...] Source from: CatsWhoCode [...]
I have a question, I installed my blog in its own directory but followed WordPress instructions to move the index so the blog can be accessed from the main index instead of going to the folder, is there a way to redirect people who try to access my installation folder to the index using .htaccess?
[...] bout de code a été trouvé sur l’excellent CatsWhoCode, un site tenu par Jean-Baptiste Jung que je suis depuis mes débuts sous WordPress et que je vous [...]
It works when you put into the .htaccess file, make sure you have a static IP
#3 and #4 are MUSTS for graphic heavy sites. Excellent post!
Very cool stuff. I really like the .htacess that reduces my spam. For the longest time I wondered why I would get a flood of like 20 spam comments however that article had little to no hits.
When using a windows server, in this case I have a web.config file, which replaces in that case my htaccess file. How can I incorporate this line to not show the category in the url?
RewriteRule ^category/(.+)$ http://www.yourblog.com/$1 [R=301,L]
I tried this but it does not work:
Any help would be highly apreciated.
Thanks,
Patricia
Hi,
I need some help with my permalinks – actually I’ve decided to change them from /%category%/%postname%/ to /%year%/%monthnum%/%category%/%postname%/
Could you please tell me how to 301 redirect them.
Thanks in advance!
Having always found .htaccess files a bit of a black art (but more obscure), this post contains some really great tips that I will be trying out soon.
I especially like the ones to do with blocking spammers, as some of our blogs get a ton of comment spam (which Akismet picks up, for the most part, fortunately).
I also love the idea of replacing hot-linked banners with adverts for your own site. Brilliant!
This is great tips. Thank you for sharing with us. Especially point no 5, it’s really help me with permalink.
Just want to share that if anybody experiencing a problem with “404 error not found” in google webmaster tool, right now there is a plugin that can fix it. Just search in the plugin area and you will have a lot of plugin regarding redirecting no need to modified your ht.access anymore.
Cheers!
not sure why when i use #7 it displays a blank page. I have an image on there with some links to other social sites but none of this displays when using the #7 hack.
Help please?
Redirect Day and name permalinks to /%postname%/
Your code is the only one that has worked for me from the other methods I’ve been trying in the past hour. Thanks heaps!
How can i hide wordpress page source, so nobody can find i am using WP as back-end .. anyone?