This is my first question here on Pro Webmaster... I'm really glad to be here!  I believe this question will have a simple answer but I'm starting with htaccess and I want to learn something about this file and its rules.  I have a long and ugly affiliate link but I want to create a 301 redirect to this URL, without typing it. My website is http://www.matthewlabs.com/ and I want to use a link like http://www.matthewlabs.com/wishonlist/appstore which automatically redirects to my affiliate link.  I tried to write this in my htaccess file:  Redirect 301 /wishonlist/appstore http://myAffiliateLinkHerebut it doesn't work. Must the directory /wishonlist/appstore exist to redirect? Because now I receive a 404 error...And to use this link, can I create a simple link with html a tag?  <a href=http://www.matthewlabs.com/wishonlist/appstore>Click</a>Thank you so much for your time and I hope you can help me!
short and friendly URL for affiliate links
htaccess;redirects;mod rewrite;links
Your .htaccess file needs to look something like this:RewriteEngine onRewriteRule [URL to redirect from] [URL to redirect to] [options]RewriteEngine on basically switches the mod_rewrite module on.Then you need to say what the URL you're expecting people to enter looks like, you can use regular expressions here, in fact, the whole thing IS a regular expression. URL to redirect to is usually internal, but it should work with a full link.So in practice, something like:RewriteEngine onRewriteRule ^/wishonlist/appstore(/)?$ http://myAffiliateLinkHere [301,L]The ^ and $ to denote the start and end of the URL, and (/)? means that it can be entered with or without a trailing slash and still work.Options - The 301 basically says send a 301 header, and L says this is a 'last instruction' - after which no more instructions should be processed.There's a good wealth of options available, check the documentation - but here's a link to a good cheat sheet I always keep handy: http://www.addedbytes.com/cheat-sheets/mod_rewrite-cheat-sheet/