How to auto-forward specific emails in gmail?

How to auto-forward specific emails in gmailHi All, I’ve got another quick tutorial for you. This time we’re looking at how to forward specific emails in Gmail to another email account.

For example, you may find yourself in the situation where you need to forward certain emails that are going to your personal Gmail account to your work or maybe your Outlook email, Hotmail, Yahoo accounts etc.

Note, this tutorial doesn’t run through how to forward all your Gmail (catch all), just certain emails. That said, it’s all in the same place and just a matter to selecting “Forward a copy of incoming mail to” if this is what you want to do.

ok, let’s crack on!

How to forward certain emails from gmail

Step 1: Go to Gmail

Login to Gmail

Step 2: Set up Forwarding Address

First you need to add the email address you want to redirect the mail to.

Go to Settings (under the cog icon) > Forwarding and POP/IMAP > Add a forwarding address

gmail > Settings > Forwarding and POP/IMAP > Add a forwarding address
Gmail > Settings > Forwarding and POP/IMAP > Add a forwarding address

 

Step 3: Verify Forwarding Address

Add and verify your forwarding address (i.e. the email address / account you want to forward email to). Note, an email will be sent to this account with a verification link to verify you are the owner. You will need to click this before continuing any further.

Step 4: Set up an Email Filter

Once verified, go back to Settings > Forwarding and POP/IMAP  and click the link that says “Tip: You can also forward only some of your mail by creating a filter!” (see image above, below the add forwarding address button). This will bring up a filter menu where you can create a filter to isolate the emails you need to forward. e.g. From: email-i-want-to-forward@domain.com

Create Filter of Emails you want to Forward
Create Filter of Emails you want to Forward

Step 5: Test and Use Email Filter

Configure your filter to match the emails you want forwarded and click “create filter with this search“. Tip – make sure you test your filter to make sure it’s capturing all/only the emails you want to forward.

Step 6: Select Forwarding Address to Forward Filtered Mail To

Once you are happy with the filter check the “Forward it to” check box and select the forwarding email address you want the email to be sent to.

In this example i am setting up a filter to forward all emails from Gumtree to another email account
In this example i am setting up a filter to forward all emails from Gumtree to another email account

Step 7: Click “Create Filter

You should have now successfully have set up Google Mail to forward emails from a specific person or domain to another email account.

A few things to note before we end this tutorial. 1) Old emails, i.e. ones that you have already received will not be forwarded. If you want these in your other email then you’ll have to forward them manually. 2) Once the forwarding filter is successfully set up, you should see a red notice bar in Gmail that says “Your filters are forwarding some of your email to email@domain.com. This Notice will end in 7 days.” This is normal.

Gmail Filter Notice

Finally, make sure you test and keep an eye on your filter to make sure all the email is being forwarded to the other email account. You don’t want to realise weeks down the line that you’ve missed an email!

I hope this post has been useful. If it has then don’t forget to show it in the comments or share the post. Thanks 🙂

How to fix a Missing/Corrupt SYSTEM file in Windows XP without the Recovery CD

XP System Fix

This tutorial aims to teach you how to fix a corrupt or missing SYSTEM file in windows XP without the use of the recovery CD.

I spent 6 hours round a friend’s house yesterday and finally came up with a solution that worked. Today, I want to share what I’ve learnt to help other folks get round this fairly common issue without the grief I had to go through!

Disclaimer – I am not a computer repair technician. Just a computer geek sharing a solution that worked for me. Continue at your own risk, I take no responsibility whatsoever what happens. Always back up, and if you’re not sure, don’t proceed.

Ok, let’s get started.

[UPDATE] one of the readers suggested i highlight earlier on that this solution will only work if you have a restore point on your machine. I’m pretty certain the machine that i fixed never had a manual system restore made and therefore, in my opinion, it’s worth trying even if you can’t remember doing so manually. I cannot confirm 100% for XP, but i know later Windows OS’ take automatic restore points when significant system events such as the installation of a program or device driver occur. Given the number of restore points found on the machine i was working on, i can only assume that this is too the case for Windows XP.

Some readers have also mentioned that in some cases viruses may have delete these restore points, so i guess its a case of take a look and hope for the best! Please note though, if there are no restore points when you look the only option is to try and get hold of the CD.

Below is a break down of the key sections of this post. I’d recommend you read the whole thing to make sure you get the best understanding of what has happened and how to fix. But, if you just want the solution click below.

What is the SYSTEM file In XP and why has it stopped my machine working?

The SYSTEM file on your computer is one of a collection of files that stores registry information about your computers configuration and set up.

All XP machines have this file stored in the following location along with a number of other key config files such as SOFTWARE, SECURITY, SAM and DEFAULT.

C:\Windows\System32\config

If you’ve received the message below when trying to boot into windows then it’s more than likely that something has happened to corrupt the file or it’s missing from the System32 config folder.

Windows XP could not start because the following file is missing or corrupt: \WINDOWS\SYSTEM32\CONFIG\SYSTEM
Windows XP could not start because the following file is missing or corrupt: \WINDOWS\SYSTEM32\CONFIG\SYSTEMYou can attempt to repair this file by starting windows setup using the original setup CD-Rom. Select “r” at the first screen to start repair.

 

How did this happen?

There are many reasons why this could have happened. For example, you might have forced a hard shutdown at the wrong time – which is what happened in the scenario I was dealing with – consequently the file has become corrupted and Windows is no longer able to boot because of this.

As the screenshot and error message above describe, the default approach to resolve is is to use the recovery console in the Windows XP installation disc, but what if you haven’t got the Windows XP CD?…

I spent a long time searching for the answer to this without any luck. My solution aims to  provide you with a quick and relatively easy way to resolve the problem without the XP CD or Recovery Console.

Why do you need the recovery disc in the first place?

From my understanding, the XP disc allows you to boot into the recovery console and use the command line to copy an older/stable version of the SYSTEM file over the corrupt or missing version. Without the XP CD you’ll find yourself completely stuck though, as you have no way to access the DOS/command prompt and copy the back up into the system32/config folder.

Note – If you have the XP CD, i suggest reading Microsoft’s official solution on How to Recover a corrupted registry that prevents Windows XP from starting as this may be quicker and easier solution for you.

How to fix the SYSTEM file without the Windows XP Recovery Disc

To summarize, my solution aims to get round this problem by:

  1. Creating a bootable version of Linux on a USB stick (if you’ve never used or heard of Linux, don’t worry, it’s not as scary as it sounds! Linux is a safe place, trust! 🙂
  2. Boot into Linux to get access to the files on the hard disc (in this instance the Ubuntu Linux Distribution)
  3. Find the broken SYSTEM and SOFTWARE files
  4. Find the most recent working backups of the SYSTEM and SOFTWARE files
  5. Overwrite the corrupt files using the Linux Interface (no need to have to use DOS commands like with the recovery CD method!
  6. Reboot back into Windows XP using most recently known working version of the SYSTEM file.

In total, this process should take about 45 minutes depending on how fast you can download and mount the Linux distribution.

Before you start, you are going to need the following:

  • A PC that works!
  • An Internet connection
  • A USB stick at least 2GB in size
  • A copy of Unetbootin

Step one – Create a  USB Boot disk with Linux using Unetbootin

Go to unetbootin.sourceforge.net and download a copy of Unetbootin.

The software is free, safe and will do all the hard work of downloading Linux and mounting it onto a USB hustle free. FYI – In this example i am using Ubuntu

MAKE 100% SURE THAT THE DRIVE YOU MOUNT THE LINUX DISTRIBUTION ON IS THE USB DRIVE. OTHERWISE YOU’LL END UP WRITING OVER SOMETHING YOU REALLY DON’T WANT TO!!!

unetbootin

Step two – Boot into Linux off the USB

Now Shut down your machine and then turn it back on whilst pressing the function key that allows you to choose your boot options – on my machine this is F12. If your not sure, you should see the this in the POST startup screen when you first power up the machine.

Select USB device in boot device menu
Select USB device in boot device menu

Note, on some systems you may need to go into your BIOS and select the option of booting into a USB device. Here’s a screenshot of where this is on my machine – yours might be slightly different…

When the option prompt appears, Select the USB Device option and press enter. If all goes to plan the machine will then proceed to boot into Linux.

When Ubuntu is loaded you may get a message that says ‘Try Ubuntu’ and another for ‘Install Ubuntu”. Just click the “Try Ubuntu” button and then it will complete loading to the desktop environment.

Click 'Try Ubuntu'
Click ‘Try Ubuntu’

Step three – locating the System32/config folder

Navigate to Windows/System32/Config folder
Navigate to Windows/System32/Config folder

Use the built-in file browser to navigate to the location of WINDOWS on the hard drive. Follow the screenshot below to help find this. You will essentially be looking for what would have been in the following location in WINDOWS:

C:\WINDOWS\system32\config\

Once you find the config folder you will see copies of all the files including the all important SYSTEM file.

open a new window
open a new window

Next we need to open a new window and find a copy of the the most recent backups of these system files which is stored in a folder called “System Volume Information” which is normally hidden in Windows. As we’re using Linux you won’t need to worry about this though, you will find this folder in what would have been the following in windows

C:\System Volume Information

System Volume Information
System Volume Information

Once in the System Volume Information folder you will see another folder called: a_restore{hexidecimal-characters}. Go in there and you should be presented with a number of different folders with the the following naming convention “RP123“. It is these folders where Windows should have saved back ups of the system files.

rp-folders

To find the most recent one, navigate to the folder with the highest value (e.g.  RP295) and go in to that and find the “snapshot” folder.

By now you should have two windows open; one with the corrupt SYSTEM file in it and one with the most current RP snapshot files.

 

The Snapshot Folder should contain all the most recently saved WINDOWS system files
The Snapshot Folder should contain all the most recently saved WINDOWS system files

Step four – Copy last know SYSTEM file into C:\WINDOWS\system32\config\

You’ll notice that the files IN THE RP “snapshot” folder  are files called _REGISTRY_MACHINE_SYSTEM and
_REGISTRY_MACHINE_SOFTWARE etc, these are the ones you want to use. Take a copy of each of these two files (right-click > copy) and then paste them into the other window where the C:\WINDOWS\system32\config\ folder is.

Step five – backup old SYSTEM and SOFTWARE files and replace

Backup old system files and then Rename the others to SYSTEM and SOFTWARE
Backup old system files and then Rename the others to SYSTEM and SOFTWARE

Rename the original SYSTEM  and SOFTWARE files to something like SYSTEM.OLD and SOFTWARE.OLD so that you have a copy of the originals.

Once you’ve done this, rename the _REGISTRY_MACHINE_SYSTEM and
_REGISTRY_MACHINE_SOFTWARE files you just copied from the snapshot folder to “SYSTEM” and “SOFTWARE”.

Step Six – Shut down, Reboot and keep your fingers crossed!

If all goes well you should see the Windows XP Loading Screen
If all goes well you should see the Windows XP Loading Screen

Time to close the windows you have open and shut down Linux (in Ubuntu this is the the button in the top right-hand corner of the screen).

Remove the flash drive and then power up the system again.
If all goes to plan, you’ve just fixed your computer Without needing the Windows XP CD! 🙂

I REALLY hope this solution has worked for you. If it has, then please please don’t forget to show your appreciation by Tweeting, Liking, leaving a comment, sharing or linking to this page. It will help others find this content. Thanks.

If you run into any issues, leave a comment and I’ll try my best to help you out!

Tom 🙂

Export Powerpoint Theme Colours & Changing Default Color Palette

I’ll admit, I’ve created a fair amount of presentations in my time and although i love working with PowerPoint, I’m not what I would call a PowerPoint guru. Not when it comes to the more advanced settings of Microsoft PowerPoint, anyway.

That said, this week i was set the task of trying to help someone with exporting PowerPoint theme colours and I thought I would share my learnings as it turns out, sometimes its not the easiest thing to get your head round.

The particular issue in question here was that when the PowerPoint presentation was being sent over to someone else who was unable to see the theme colours that were present on the original person’s machine.

What follows, are my take aways from this particular occasion:

  • What Are PowerPoint Themes?
  • Where Can I find PowerPoint Themes?
  • How to Customise the Colour Palate in PowerPoint?
  • How to Export and Share PowerPoint Theme Colours?

What Are PowerPoint Themes?

PowerPoint themes are used to define the look and feel of your presentation. Themes extend beyond just colours, they allow you to customise font size, style, background, layout and the general look and feel of your presentation.

There are a number of built in themes in PowerPoint which are great if you want to put something together quickly or as a one off, but if you are a business, you want something a little more custom and particular to your needs and style. Enter custom Themes and Slide Masters.

Where can i find Power Point Themes?

To find the PowerPoint Themes, click on the “Design” tab and there you will be presented with a selection of the previously mention “built in” themes. Here you can select from a number of themes and apply these to your presentation for a nice, easy and quick solution.

If you want to go ahead and create something of your own though, the “Slide Master” section is where you need to be. This area of PowerPoint will allow you to create custom designs and layouts for your PowerPoint presentation slides.

How to Create Custom Colours in PowerPoint?

In order to change the colours that are available in default colour drop down boxes you need to change the Theme Colors section under the “Design” tab.

Go to:

Design > Colors > Create New Theme Colors

Powerpoint-Theme-ColoursHere you will be create and save your own theme of colours which when selected will not only adjust the style of your slides but also the colour in the colour swatch in PowerPoint.

Note, only 10 colours are avaiable in the default colour swatch dropdown. These include the “Text/Background” and “Accent” colours you define.

How to Export and Share PowerPoint Theme Colours

If you create a new template and then send it to someone else, they will see the colours of your theme and be able to use them but if they start messing around with the styles in the “Design” tab, these seem to get lost. Whats going on Microsoft?…

To get round this, you need to make sure that the machine you are working on has the Theme’s Color XML file. This will ensure that no matter what happens, you will always beable to revert to the custom Theme colours you have defined.

If you find yourself in this situation, then my advise is that you send the other user a copy of the presentation and the theme XML file and get them to install the themeXML in their theme colors  folder.

On a windows 7 machine, the theme colours XML file can be found in the following location:

%USERPROFILE%\AppData\Roaming\Microsoft\Templates\Document
Themes\Theme Colors

Note, the location may differ depending on the version of windows and particular set up of the machine being worked on.

Like i said, I’ not a PowerPoint expert. If you know of a better way of dealing this problem or theme colours i would love to hear it. Please leave a comment below.

How to transfer contacts from iPhone to Google Contacts

How to transfer contacts from your iPhone to Google ContactsTime for another quick how to. This time we’re looking at how to migrate your contacts from your iPhone to Google contacts. This wil be useful for anyone that is moving from iOS over to android or just simply wants to make sure that their iPhone contacts are synced with whats in Gmail or Google contacts is.

I should point out that although the title of this post is “How to Transfer contacts from iPhone to Google Contacts”, this will actually work for any itunes account that has iCloud set up as we’ll actually be exporting your contacts from iCloud to Google Contacts.

Before we go any further, make sure you’ve backed up your iPhone just to make 100% sure that everything is safe and sound and you can revert back if needed. 

Right, lets sync these iPhone contacts with Google Contacts!

Ok, first step is to make sure that you have iCloud set up on your iPhone and are syncing your contacts. To check this, pick up your iPhone and go to:

Settings > iCloud > Contacts

Make sure that the you are using iClound and that the contacts sync setting is on.

iCloud Settings in iPhone iOs
iCloud Settings in iPhone / iOs

Step 2: With that confirmed, go to https://www.icloud.com/ and Login with your itunes details.

iCloud Dashboard
iCloud Dashboard

Step 3: Once logged into iCloud, go to your contacts and make sure that all the contacts are in there.

icloud contacts list
icloud contacts list containing all the contacts that are also on the iPhone

Step 4: Now for the slightly tricky bit, selecting all the contacts in the Contact list. To do this, single click the first contact on the list, scroll to the last contact, then click the last contact whilst holding down the shift button. This should select all contacts in your list as demonstrated in the screenshot below.

Note, if you don’t select all the contacts the export will only export one contact at a time which is not what you want to do if you have more than 2 contacts! (btw if anyone else knows of an easier way of selecting all contacts leave a comment below. I couldn’t find one via the menu – I’m guessing apple don’t want to make it easy to transfer contacts from iclould to another system like Google Contacts – who knows!?)

icloud contacts selected
iCloud Contacts selected – notice the blue highlighting and all the contacts appearing in the right hand window.

Step 5: With all your contacts selected, export your iPhone contacts in the vCard format  by clicking on the cog icon in the bottom left of the screen – see image below “Export vCard”.

export  cloud contacts in vcard format
export cloud contacts in vcard format – note the default name of the file might be the first contact on your list, don’t worry, if you have all the contacts will be in the one file. If you want to make sure, have a look at the size of the file after download – if its over 1K then everything should be good – right click the file and open with notepad if you want to make 100% sure…

Step 6: With your vCard file of all  your contacts downloaded, all you need to do now is to log into Google Contacts and then use the import function. To do this:

  1. Sign in to http://www.google.co.uk/contacts/
  2. Select the contact import tool under “More”

    Google Contacts Import Tool
    Google Contacts Import Tool
  3. Click “Choose File” and locate the vCard file you downloaded from iCloud

    Upload vCard File
    Upload vCard File
  4. Once processed, all contacts should be ready for you to view and amend before saving.
  5. If you’re happy with all the information imported then go ahead and save and your done! you should have now successfully transferred all your contacts from your iPhone and into Google Contacts. If you have an Android mobile phone then that uses your Google profile, you should see all your contacts on the device.

If this tutorial has been helpful please don’t forget to show it by leaving a comment, tweeting it or liking it on Facebook. Cheers! 🙂

NEW Whois Lookup Tool

Free Whois Lookup Tool by Bandertron
A Free Whois Lookup Tool by Bandertron

Its been a while since I’ve been able to have time to code but this week I’ve managed to get into the thick of it. A bi-product of this work has been the new Whois Lookup Tool.

I’ve been meaning to create one of these for AGES and all previous attempts have either failed or been abandon half way through…

This time, I’m hoping that bar the odd tweak here and there, i might of nailed it 🙂

So, What Does it do?

Its pretty straight forward to be honest, you give the tool an IP address or a domain name and it goes and looks up who the registered owner is and returns this and other registrant information such as address, date of registration, expiry, DNS servers etc.

Give it a try and you’ll see what i mean. Let me know what you think and if you manage to break it or have any thoughts for inprovement – would love to hear from you!

FYI – as I hinted towards earlier, the Who is Lookup tool is part of another project that I’m currently working on so keep posted…

BTW – if you missed the last tool i created (Social Velocity – discover the reach and engagement of your content) check it out and let me know what you think of that as well!

Social Velocity | Social Media Tool to Determine Content/URL Reach

Social Velocity  - Discover the social reach of your content
Social Velocity – Discover the social reach of your content

Last week i found myself in the situation when i had a URL which i wanted to know how many tweets, likes and Google+s it had. The problem was, the page didn’t have a social share widget that displayed the social stats for that content.

This got me thinking… and that thought became ‘Social Velocity

Social Velocity is a free Social Media Tool that tells you how many tweets, Facebook likes, Google+s a particular piece of content has accumulated over its life time.

The full list of Social metrics the Tool provides is as follows:

  • Facebook Shares
  • Diggs
  • Delicious
  • Tweeter / Tweets
  • Pinterest Pins
  • LinkedIn Shares
  • Reddit Score
  • Google Pluses
  • Stumble Upons

So, if you’re asking your self any of the following questions, give ‘Social Velocity‘ ago:

How many tweets have their been for this URL?

How many people have liked or shared this page on Facebook?

How many likes do i have?

How many Diggs have i accumulated over time?

I’ll be honest with out, its not the most amzing tool that i’ve created but with this is just phase one of the tool and I’m looking for ideas on what features would be nice to include. So, if you have any suggestions there’s a comment box down there with your name on it!

Likewise, if you have any f4edback on the design I’d like to hear that too. TBH I probably spent more time messing about with the Look and Feel of it than i did coning the main logic!

Enabling CURL in PHP (PHP.ini, WAMP, XAMPP, Ubuntu)

Enabling cURL in PHP
Enabling php_curl in PHP

In this quick tip tutorial we’re looking at how to enable CURL in PHP. I’ve included a number of different options as it may be different depending on what your running.

For those that want a bit of background on what CURL is and can be used for continue reading. If you just want the answer click here!

What is CURL?

CURL is a library created by Daniel Stenberg that allows you to connect and communicate via a variety of different protocols such as HTTP, HTTPS, FTP, Telnet etc

I personally use cURL as an alternative to file_get_contents(URL) to get web content as it provides better performance and additional functionality and flexibility.

Why doesn’t CURL work on my computer?

By default CURL isn’t enabled in Apache and therefore trying to make a CURL call won’t work until you’ve enabled it.

CURL Error Message

If curl isnt running and your trying to run it In php you’ll more than likely be Seeing an error message like : “Fatal error: Call to undefined function curl_init()”

Right, now we’ve covered that lets get cURL working!

How to enable CURL in Apache

There are a few ways I found to go about enabling CURL in apache. The one you choose will depend on what OS your running and which flavour of Apache you’ve got.

Hopefully one of these should sort you out:

Option 1 : enable CURL via the php.inI

This is the main method on any windows install like WAMP, XAMPP etc

  1. Locate  your PHP.ini file
    (normally located at in the bin folder of your apache install e.g.
  2. Open the PHP.ini in notepad
  3. Search or find the following : ‘;extension=php_curl.dll’
  4. Uncomment this by removing the semi-colon ‘;’ before it
  5. Save and Close PHP.ini
  6. Restart Apache
Location of php.ini - click to enlarge
Location of php.ini - click to enlarge

Option 2: Enabling CURL in WAMP

  1. Left-click on the WAMP server icon in the bottom right of the screen
  2. PHP -> PHP Extensions -> php_curl

Option 3: enable CURL in Ubuntu

Run the following command:

sudo apt-get install php5-curl
sudo service apache2 restart

How to Make sure CURL is enabled and running

phpinfo() output in WAMP

Option 1: Use the phpinfo() command to output PHP’s configuration and look for curl support under the listed environment variable/modules


Option 2: Create and run a simple PHP  script like the following:

// reinitialize curl resource
$ch = curl_init();// set url
curl_setopt($ch, CURLOPT_URL, “domain.com”);

//return the as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

// echo output string
$output = curl_exec($ch);

echo $output;

        // close curl resource to free up system resources
curl_close($ch);

Option 3: On a unix machine type the following command:

php -i | grep curl

That’s it. Your done!

If you have any questions leave them below. Don’t forget to share this if it was useful!

How to Export / Backup CuteFTP Site Manager

How to backup CuteFTP
How to backup CuteFTP

Skip To Quick Solution

In the past I’ve had issues using CuteFTP’s Import / Export feature to migrate my FTP site list, in particular, loosing password information. This tutorial teaches you how to export or backup your CuteFTP Site Manager and keep your passwords and connection data intact.

Notice: Before we go any further…

This is the process i use when i need to quickly transfer my FTP connection data over to a new machine or if for some reason i need to reinstall CuteFTP (CuteFTP 7 & 8).  Whether it is the ‘right way’ I’m not sure, but it works for me. I take NO responsiblity for any mishaps you may have following this process. Just be careful and if your not sure, leave it.

For reference, here is a link to Globescape’s support page.

It’s pretty straight forward stuff to be honest, the annoying part generally being finding where the Site Manager sm.dat file is stored. sm.dat is CuteFTP’s file which stores all the connection info.

To find Site Manager path, use the menu and go to:

Tools >> Global Options >> Security

Under the Security section you should see the Site Manager Path. It should look something like this:

Cute FTP's Site Manager Path

Navigate to the location of the sm.dat file and make a copy of it.

You sould now be able to place this into a fresh CuteFTP install and use Tools >> Global Options >> Security to point at your backed up sm.dat.

Quick Solution

Read the notice before continuing:

  • Open CuteFTP
  • Menu >> Tools >> Global Options >> Security
  • Find Site Manager Path (see image above)
  • Copy sm.dat file at that path
    (Mine was: C:\Documents and Settings\Administrator\Application Data\GlobalSCAPE\CuteFTP Pro\8.1\sm.dat)
  • Paste sm.dat into the appropriate folder in the new CuteFTP install
  • Point CuteFTP to the new sm.dat
  • Done

Related Tutorials

CSS Browser Hacks

CSS Browser Hacks
CSS Browser Hacksl

Here we’re going to have a look at a few CSS browser hacks which you can use in those horrible situations where the page looks perfect in all browsers apart for one (IE6 cough!).

@import

@import is used to link an external stylesheet from within a stylesheet/CSS. Earlier version 4 browsers (e.g. Netscape Navigator 4) do not understand this rule and therefore ignore it.

Use the @import if you need to hide styles from older version 4 browsers:

@import "mystyle.css";      /* hidden from most version 4 browsers  */
@import url('mystyle.css'); /* understood by IE4 but not NN4 */

<!–[if IE]> Conditional Statements

Internet Explorer (aka IE) have conditional statements that allow you to give instructions based on the IE and the version of Internet Explorer running.

<!--[if IE]>
This will echo if the browser is Internet Explorer
<![endif]-->
<!--[if IE 5.5]>
This will echo if the browser is Internet Explorer version 5.5
<![endif]-->
<!--[if IE 6]>
This will echo if the browser is Internet Explorer version 6
<![endif]-->

IE 6 Only Hack

If everything works in Firefox, IE7 but not in Internet Explorer 6, use the star html hack:

* html .myclass{
 /* this will only work in IE6	*/
}

You can also use the underscore hack but I prefer not to as this will cause validation errors in your CSS. Just for reference, here’s an example of the underscore hack:

p{
 margin:0;
 _margin-left:5px; /* only IE6 will process this line */
}

Firefox Only Hack

I came up with this when messing around with child selectors. I don’t know whether it has a name or if other people are using it but it seems to work quite nicely in the version of firefox I was running… (I haven’t tried it in other browsers but  it validates fine)

Update: its called the child hack. Opera and Safari should process this aswell.

p.myStyle{
color:red;
}

p > .myStyle{
color:blue; /* Only Firefox runs this style */
}

Everything but IE6

Heres a hack that works in Firefox and IE7. Handy if you want everything but IE6 to run it. Better still, it validates as well.

html[xmlns] .myStyle{
 /* Firefox and IE7 process this but the document must be XHTML to work */
}

To Hack or not to Hack?…

A lot of the time CSS hacks are just a quick solution for us developers, we don’t care how it works as long as it does. However, my advice is avoid this and try to find out why there is a problem in the first place.

A little time spent looking into the problem itself and not a workaround will not only give you a far better understanding of CSS and browser iregularities but also stop you repeating the same thing the next time round.

Tutorial Name: CSS Hacks

Related Tutorials:

301 redirects using htaccess

301 redirect htaccess tutorial
301 redirect htaccess tutorial

In this tutorial we look implementing 301 redirects using htaccess and cover the following:


Before we go any further lets cover a few important points to bare in mind before starting:

  • htacccess is a configuration file for Linux Apache servers and not traditonally available on an IIS/Windows server (using Windows/IIS?)
  • The Apache Mod-Rewrite moduled must be enabled – uncomment LoadModule rewrite_module modules/mod_rewrite.so in your httpd.conf
  • RewriteEngine must be declared On in your htaccess file, we’ll come to this

What do we mean by 301?

301 is the status code returned by the server. When a 301 response is returned this means the requested resource/page has been permanently moved to a new location.

There are other redirects such as 302 or 307 redirects which are also known as temporary redirects. In all the programming languages or configuration utilities i’ve come across  302 redirect has been the default so to make it a permenant  redirect you have to explicitly defined this.

RewriteEngine on

Before we write any code we need to make sure the RewriteEngine is on. The following code does this:

RewriteEngine on

Quick & Simple redirects

Here are 2 methods of writing a simple permenant redirect in htaccess. This will redirect www.domain.com/old to www.domain.com/new. Note, it doesn’t have to be a directory, it could also be old.html and new html

Redirect permanent /old http://www.domain.com/new

or

Redirect 301 /old http://www.domain.com/new

I find either of these two methods ideal if you need to redirect a small number of pages as they are easy to remember and straight forward to setup.

Redirects using RewriteRule

The following example uses a RewriteRule and a regular expression to map ALL the pages/files of an old domain to a new one. Note the [R=301], this sets the redirect as a 301 response.

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

Although regular expressions can be tricky the result is worth the effort – in this line of code we have correctly redirected and mapped the entire website to its new domain.

RewriteConditions

Its not always the case you need everything redirected, sometime you need to be selective in your redirectionsg. Htaccess provides this flexibility through it’s RewriteCond directive.

Here are a few examples of RewriteCond in action:

Redirecting nonwww to www

Redirects all nonwww requests to the relevant www version.

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{http_host} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,NC]

This rule says ‘redirect (301) all requests that are made under the nonwww to their relevant www version but ignore this if the request is under the www’.

Redirecting http to https

Redirects all http requests to the relevant https page by using port 443 as a condition.

RewriteEngine On
RewriteCond %{SERVER_PORT} !443
RewriteRule (.*) https://www.example.com/$1 [R=301]

What if I’m hosted on a Windows/IIS Server?

If you’re using an IIS / Windows server you won’t be able to use the code below to perform your redirects. Instead, you will need to make the changes directly through the IIS interface, use a code alternative or look into using an IIS module that allows you to simulate htacces. ISAPI_rewrite is a popular alternative, visit http://www.isapirewrite.com/ for more info.

Here is a a good 301 redirect tutorial that shows how to set this up in IIS.

Useful Resources