.htaccess and WordPress tips
Most of you probably already know quite a few things about .htaccess file and what you can or can’t do with it, but for people who are looking for a quick ref for their WordPress blog and .htaccess help here’s what you need to do in order to get the most out of your site and server.
Remove the /category/ from your url
RewriteRule ^category/(.+)$ http://www.yourblog.com/$1 [R=301,L]
User Browser Cache to make your blog load faster – decrease page load speed
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"
In all shared hosting servers at GoZEN Host, we do have mod_expires compiled with apache or nginx server or LiteSpeed
Stop others stealing bandwidth from you by hot-linking your images etc
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]
Block access to spammers etc with .htaccess
order allow,deny deny from 192.168.2.1 allow from all
You can share your thoughts about .htaccess with us, our team is always here for you!
Leave a Reply