Activity Stream
48,167 MEMBERS
6888 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 6 of 6
  1.     
    #1
    Member

    Default How to: Create friendly URLs with your .httaccess File!

    How to: Create SEO Friendly URLs with your .httaccess File!

    An example of SEO friendly URL can be seen in this page. Compare it with urls like http://mysite.com/?t=34 , you will find it easier to remember and the it also clearly tells you what this page is about. Furthermore, the words in the URL might match the search keywords, bringing more traffic from search engines.


    If you are running a WordPress blog then you most likely will not need to edit your .httaccess File to make it URLs SEO Friendly as WordPress already has plenty of SEO Friendly features and plugins.


    1. Creating .htaccess file


    If you don't have a .httaccess file already created then create one and add the following lines if you already haven't.
    Code: 
    
    Options +FollowSymLinks
     
    RewriteEngine On
    The first line Options +FollowSymLinks is required for some server configurations.


    2. Create your own rewrite rule

    For example, if you want to change links like http://mysite.com/index.php?topic=rules to http://mysite.com/topic/rules/, here?s the rewrite rule:
    Code: 
    
    
    Options +FollowSymLinks
     
    RewriteEngine On
    RewriteRule ^topic/([a-zA-Z0-9]+)/$ index.php?topic=$1


    ? Like regular expressions, the [a-zA-Z0-9] matches lower and uppercase of alphabets and numbers.
    ? The asterisk inside the brackets + is a quantifier that match 1 occurence to infinite occurences.
    ? Combining them, ([a-zA-Z0-9]+) matches alphanumerics of at least 1 character.
    ? The caret ^ means ?start with?, meaning the URL starts with the word ?topic?.
    ? The dollar sign $ means ?end?, meaning the URL ends with a slash.
    ? The $1 is backreference, it carries the content of the first group of brackets.
    In other words, when user enters http://mysite.com/topic/faqs/ , the page being called and run would be http://mysite.com/index.php?topic=faqs


    Example 2

    If you want to change URLs like http://mysite.com/index.php?product=...tname&price=30 to http://mysite.com/products/productname/30/. Basically its similar to above:



    Code: 
    Options +FollowSymLinks
     
    RewriteEngine On
    RewriteRule ^products/([a-zA-Z]+)/([0-9]+)/$ index.php?product=$1&price=$2


    ? The [0-9] in matches numbers only.
    ? The plus sign is a quantifier that match 1 or more occurences.
    ? Combining them, ([0-9]+) means 1 or more numbers.
    ? Similarly, $1 will be the first brackets : product name and $2 would be the second brackets : price.


    Example 3

    If you want to change URLs like http://mysite.com/article.php?id=45 to http://mysite.com/article-45.html, here?s how:
    Code: 
    Options +FollowSymLinks
     
    RewriteEngine On
    RewriteRule ^article-([0-9]+)\.html$ article.php?id=$1
    ? The new thing here is the \. (backslash followed by a dot).
    ? The backslash here ?escapes? the dot, so that the dot means a real dot instead of ?anything?.

    3. Extra Stuff
    Custom 404 error page

    Put this in your htaccess if you would like to have a custom 404 error page instead of the default one.

    Code: 
    ErrorDocument 404 /404.php
    Change the 404.php to your page.

    Disable directory browsing

    For security purpose, its best to disable directory browsing so that people won?t know what files you have. Use this :

    Code: 
    Options All -Indexes
    Protect .htaccess files

    This should disallow other to access your .htaccess file, just like disallowing others to access your wordpress?s wp-config.php

    Code: 
    <files .htaccess>
    order allow,deny
    deny from all
    </files>
    Alternatively, if you are not able to do these things on your own there are a few online Online URL Rewritters, which will make everything easier and simpler for you:

    http://www.webconfs.com/url-rewriting-tool.php
    http://www.myseotool.com/free-seo-to...-generator.php
    http://www.generateit.net/mod-rewrite/
    http://www.webmaster-toolkit.com/mod...enerator.shtml

    Static URLs are known to be better than Dynamic URLs because of a number of reasons
    1. Static URLs typically Rank better in Search Engines.
    2. Search Engines are known to index the content of dynamic pages a lot slower compared to static pages.
    3. Static URLs are always more friendlier looking to the End Users.

    Example of a dynamic URL
    Code: 
    http://www.widgets.com/product.php?categoryid=1&productid=10
    This tool helps you convert dynamic URLs into static looking html URLs.

    Example of the above dynamic URL Re-written using this tool
    Code: 
    http://www.widgets.com/product-categoryid-1-productid-10.htm
    Note*
    You would need to create a file called ".htaccess" and paste the code generated into it, Once you have created the .htacess file simply copy it into your web directory.
    URL rewriting of this type would work ONLY if you are hosted on a Linux Server.

    This tutorial was not fully written by me.
    Raptile Reviewed by Raptile on . How to: Create friendly URLs with your .httaccess File! How to: Create SEO Friendly URLs with your .httaccess File! An example of SEO friendly URL can be seen in this page. Compare it with urls like http://mysite.com/?t=34 , you will find it easier to remember and the it also clearly tells you what this page is about. Furthermore, the words in the URL might match the search keywords, bringing more traffic from search engines. If you are running a WordPress blog then you most likely will not need to edit your .httaccess File to make it Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Member
    Nice, I actually have a problem with IPB. everytime I change it to friendly urls and edit htaccess all my pages get 404 error code. i guess because its not for apache but I don't know it exactly.
    Biggest shit hosts: freakshare, letitbit, henchfile, shareflare, uload.to.
    I highly recommend you guys to stay away from these..

  4.     
    #3
    Member
    Website's:
    tetrawebs.com
    Thanks for this amazing tut buddy!

  5.     
    #4
    Member
    Website's:
    iFunMaza.com
    TFS especially custom 404!

    FB - http://www.facebook.com/IfunMaza
    Twitter - twitter.com/#!/iFunMaza

  6.     
    #5
    Member
    I've updated the thread, i hope you find it useful.

  7.     
    #6
    Member
    Website's:
    vHostLayer.com
    Nice Detailed Tutorial

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Which file-host is the most "user-friendly"?
    By rocksssss in forum File Host Discussion
    Replies: 20
    Last Post: 12th Dec 2011, 05:56 AM
  2. why no search engine friendly urls in KWWHunction?
    By godfather in forum General Discussion
    Replies: 3
    Last Post: 8th Jul 2011, 02:03 PM
  3. the txt file with 500 warez forum urls
    By wman in forum General Discussion
    Replies: 17
    Last Post: 21st Jan 2010, 06:46 PM
  4. Mod Rewrite Friendly URLs => .htaccess
    By kamrul in forum vBulletin
    Replies: 4
    Last Post: 25th Dec 2009, 09:37 PM
  5. EU Calls For Consumer-Friendly Approach To File Sharing
    By DeathKnell in forum News & Current Events
    Replies: 0
    Last Post: 11th Jul 2009, 06:57 AM

Tags for this Thread

BE SOCIAL