Results 1 to 6 of 6
-
19th Feb 2012, 10:39 AM #1OPMember
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
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 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
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
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>
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
Example of the above dynamic URL Re-written using this tool
Code:http://www.widgets.com/product-categoryid-1-productid-10.htm
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
-
22nd Feb 2012, 12:39 AM #2Member
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..
-
22nd Feb 2012, 04:58 AM #3MemberWebsite's:
tetrawebs.comThanks for this amazing tut buddy!
-
22nd Feb 2012, 05:29 AM #4MemberWebsite's:
iFunMaza.comTFS especially custom 404!
-
27th Feb 2012, 07:43 PM #5OPMember
I've updated the thread, i hope you find it useful.
-
18th May 2012, 04:53 AM #6
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Which file-host is the most "user-friendly"?
By rocksssss in forum File Host DiscussionReplies: 20Last Post: 12th Dec 2011, 05:56 AM -
why no search engine friendly urls in KWWHunction?
By godfather in forum General DiscussionReplies: 3Last Post: 8th Jul 2011, 02:03 PM -
the txt file with 500 warez forum urls
By wman in forum General DiscussionReplies: 17Last Post: 21st Jan 2010, 06:46 PM -
Mod Rewrite Friendly URLs => .htaccess
By kamrul in forum vBulletinReplies: 4Last Post: 25th Dec 2009, 09:37 PM -
EU Calls For Consumer-Friendly Approach To File Sharing
By DeathKnell in forum News & Current EventsReplies: 0Last Post: 11th Jul 2009, 06:57 AM
themaCreator - create posts from...
Version 3.24 released. Open older version (or...