Grab the RSS feed

URL Rewriting

Sometimes you may be seen the URL doesn’t have the extensions like .php, .html, .asp or anything else.
Because they are aware of SEO and the security .Before going to the URL rewrite we see the small introduction of SEO.

What is SEO?

1. SEO stands for Search Engine Optimization.
2. If you don’t know about SEO what do you first do?
3. Go for the Google or other search engines then type SEO and press enter. It provides the millions and millions of WebPages
4. But you read only the first few pages or first page alone.
5. So the website owners work hard to publish their pages in the first few pages.
6. What are the advantages for them?
7. They got advertising through the page rank. So they earn the lot.
8. For this purpose we go for the url rewriting.

URL rewriting in PHP

For this you need to run in the linux server.

Step 1:Create the file using notepad or wordpad with extension “.htaccess”.It must be accurate.
Step 2:save in the root directory.
Step 3:create the PHP file

< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
< xmlns="http://www.w3.org/1999/xhtml">
<>
< equiv="Content-Type" content="text/html; charset=utf-8">
<> Trial< /title >
< ?php
$_GET;
? >
< /head >

<>

<> <>
< href="Ajaxhelper"> Test This < /a > <> <>
< href="PHP">  I am going to test < /a > <> <>
< href="Ajax"> Then  < /a > <> <>
< href="Java1234">  Watch  < /a > <> <>
< href="pg123">  The< /a > <> <>
< href="1234">   URL < /a >
< /body >
< /html > 

Then Create the .htaccess file

Options +FollowSymlinks
RewriteEngine On
# Prevent Directory Listing
Options -Indexes
RewriteRule ^([a-z0-9A-Z]+)/?$ index.php?a=$1 [QSA]


How it runs?
• RewriteRule - Tells Apache that this like refers to a single RewriteRule.
• RewriteEngine On- # Turn on the rewriting engine
• # - Command Line
• Options +FollowSymlinks – It is an optional


Don’t forget to put $_GET on the PHP file.If you don’t put it it wont be run. Please try it and leave comments…

0 comments:

  •  
    Real Time Web Analytics