Friendly URLs by .htaccess Rewrite

In this tutorial you will learn how to replace your messy URLs with nice ones. There are many reasons to use pretty URLs:

  1. easy to remember
  2. looks great
  3. search engine friendly
  4. easy to link

Here is a messy URL:

And this is the nice URL what we like to have:

Let's get started. Open Notepad or any plain text editor.
Insert this code to your file and save it as .htaccess without any extension:

RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+)/?$ index.php?page=$1

The final step is to upload this .htaccess file to your website root folder.


Related articles

Redirect www to non www with .htaccess RewriteRule

Redirect www to non www with .htaccess RewriteRule


Redirect your websites visitors from to without www.

Unordered List Style Image CSS

Unordered List Style Image CSS


Learn how to style UL with any image using CSS.

OL and UL List CSS Style

OL and UL List CSS Style


Styling ordered and unordered lists is easy. Just write a single line of CSS to change the list style type.

1 comment

Gary2012-11-05 12:51

Nice article :)

Leave a comment

We welcome any comment from you! Please keep in mind that comments are moderated and rel='nofollow' is in use. So, please do not use a domain as your name or a spammy keyword, or your comment will be deleted.

Name: *

E-mail: *

Message: *

Click on the airplane *

Find us on Facebook



Back to Top