How to Use .htaccess to Easily Mask Links
This guide assumes you have already setup a website running on an Apache based webserver. If you are using IIS you will need a third party plugin such as IIS Rewrite.
Often times you may want to redirect links from your site as opposed to linking directly. This has a few benefits:
- If you need to change a link’s address you only have to change it in one spot instead of updating every page.
- Many visitors distrust long URLs such as those used for affiliate marketing
- Its easier to track how many people are clicking which links by using a redirect in between
First, create a special directory for the .htaccess redirect file. This is to prevent from interfering with any other .htaccess files that may be on your website. Name your directory something like links/ or visit/ as this is what the visitor will see in their status bar when they hover over the link.create a .htaccess file with the following
RewriteEngine On # Shopping RewriteRule ^amazon$ http://www.amazon.com RewriteRule ^ebay$ http://www.ebay.com RewriteRule ^newegg$ http://www.newegg.com # Search Engines RewriteRule ^google$ http://www.google.com RewriteRule ^yahoo$ http://www.yahoo.com RewriteRule ^msn$ https://www.msn.com RewriteRule ^ask$ http://www.ask.com
You can place a pound sign (#) to write comments and organize your links. Now, if you wanted to link to Google you would use the address http://www.yoursite.com/links/google (or whatever directory you created). Notice the (^) before and ($) after the link name.
Conclusion and Further Reading
.htaccess is a powerful way to manage your site. There are many more applications for .htaccess files such as password protection and migrating to a new file structure.
Look for a more comprehensive guide to .htaccess files here on EJ Web Development.
Installing Apache, MySQL, and PHP on Windows with WAMP (The easy way)
This tutorial explains, step-by-step, how to install Apache, MySQL and PHP on Windows the easy way using WAMP. WAMP is an all-in-one program bundle that includes preconfigured versions of Apache, MySQL, and PHP.
Start off by downloading the latest version of WAMP from the WAMP download page.
A warning message appears warning you not to install with previous versions of WAMP. If you have an earlier version of WAMP installed, uninstall it.c Click yes.
The WAMP setup welcome screen appears, click next.
The license agreement dialog will appear, accept and click next.
Choose your installation directory (Note that Apache, MySQL, and PHP will all be installed under this directory). Click next.
A dialog prompting you to choose what icons to load will appear, choose which icons to load and click next.
Now we are ready to install, verify the information is correct and click install.
After installation, a message box will prompt you to select your default browser for WAMP.
Next, a message box will ask you to install the default WAMP homepage. This will create an index.php in your document root to show that everything is working correctly. If you select yes, you can easily overwrite this file later.
Next, a dialog prompting you for PHP mail configuration will appear. This is for scripts that can automatically send email. If you do not yet have a SMTP server or have one that requires authentication, leave the SMTP server as localhost and you can change it later. Click next.
Now we are ready to launch WampServer. Select Launch WampServer 2 now and click finish.
Notice a icon in your system tray.
Clicking on this icon lets you easily manage Apache, MySQL, and PHP with easy access to important directories and configuration files. It also allows to to stop and start each service or all at once. Especially notice the ‘www directory’ as this is where you can begin to upload your website.
Wamp 2 also includes phpMyAdmin and SQLiteManager which are very useful web applications for managing your MySQL databases.
Conclusion and further reading
WAMP is a great tool that simplifies the process of installing a web server on your windows computer.
Now that all the server software is installed you can start installing web scripts such as Wordpress, Zencart, and Drupal just to name a few.
Installing Apache 2.2.x web server on Windows
This short tutorial explains how to install Apache 2.2.x on any computer running Windows.
Apache web server is the number one web server in use today used for both large and small sites. Apache is used for large commercial sites as well as smaller sites. Apache is free, and available for nearly every operating system. Having your own apache server is a great way to test your sites without having to constantly upload to a web host.
First, download the installer from The Apache foundation website: http://httpd.apache.org/download.cgi. Scroll down to the section that reads Apache HTTP Server 2.2.x. Look for the two lines that begin with Win32 Binary.











