Web Design Blog

htaccess fun

This is where we store some of our Web Development thoughts, tips and tricks, just because we like to share.

htaccess- 301 Redirect Old URLs With Spaces

Here’s a quick and easy htaccess 301 redirect tip. So, you have a URL like this: http://www.example.co.uk/this is_a_file.html and you want to redirect it to: http://www.example.co.uk/this_is_a_file.html All you need to is quote the URL like this: 1 Redirect 301 "/this is_a_file.html" http://www.example.co.uk/this_is_a_file.html

23 Aug 2011 / 1 Comment / htaccess fun / by Maruf

htaccess- Hide File Extension

I only used this code for the first time last week, but seems to work pretty well. The same code is plastered all over the internet on various websites, so I’m only jotting it down for my own personal reference. Hiding File Extensions What this piece of htaccess code basically does is allow you to [...]

07 Jun 2011 / 1 Comment / htaccess fun / by Maruf

Htaccess- 301 Redirect An Entire Directory / Folder

Here’s a simple pierce of code which will permanently redirect a folder / directory. For example, if you have a directory in the following path: http://www.example.com/pictures/, and for whatever reason decide to rename the directory to http://www.example.com/new-pictures/, the following htaccess code will safely redirect all users from /pictures/ to /new-pictures/ Redirect An Entire Directory / [...]

19 Sep 2009 / 5 Comments / htaccess fun / by Maruf

Htaccess: Prevent People Hotlinking Your Images

Here’s some Htaccess code that will prevent people from hotlinking images hosted on your server. Simply change the domain to yours and then apply the code to your .htaccess. It’s as easy as that. 1 2 3 RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http(s)?://(.*\.)?brightcherry.co.uk [NC] RewriteRule \.(jpeg|jpg|gif|png)$ – [F] The code is basically saying that all [...]

22 Aug 2009 / 1 Comment / htaccess fun / by Maruf
© 2012 BrightCherry :)