URL rewriting-various exercises-seo

 Installing mod_rewrite
 Testing mod_rewrite
 Working with regular expressions
 Rewriting numeric URLs with two parameters
 Rewriting keyword-rich URLs
 Building a link factory
 Pagination and URL rewriting
 Rewriting images and streams

If you’ve installed Apache yourself, read on. Because of its popularity, mod_rewrite is now included
with all common Apache distributions. If desired, you can verify if your Apache installation has the
mod_rewrite module by looking for a file named mod_rewrite.sounder the modulesfolder in your
Apache installation directory.
However, mod_rewrite may not be enabled by default in your Apache configuration. To make sure,
open the Apache configuration file, named httpd.conf.

Once mod_rewrite is installed and enabled, you add the rewriting rules to the Apache configuration
file, httpd.conf.

You use this to have mod_rewrite translate my-super-product.htmlto product.php?product_id=123.
The linethat precedes the RewriteRuleline is a comment.
# Translate my-super.product.html to /product.php?product_id=123
RewriteRule ^my-super-product\.html$ /product.php?product_id=123
You can find the official documentation for RewriteRuleat http://www.apacheref.com/
ref/mod_rewrite/RewriteRule.html.
In its basic form, RewriteRuletakes two parameters. The first parameter describesthe original URL that
needs to be rewritten, and the second specifies what it should be rewritten to. The pattern that describes the
original URL is delimited by ^and $, which assert that the string has nothing before or after the matching
text (explained further in the following sections), and its contents are written using regular expressions,
which you learn about next.

Using RewriteBase

The regular expressions and scripts in this book assume that your application runs in
the root folder of their domain. This is the typical scenario. If, however, you host your
application in a subfolder of your domain, such as
http://www.example.com/seophp, you’d need to make a few changes to accommodate 
the new environment.

The most important change would be to use the RewriteBasedirective of mod_rewrite
to specify the new location to act as a root of your rewriting rules. This directive is
explained at http://www.apacheref.com/ref/mod_rewrite/RewriteBase.html.
Also, the rewritten URL should lose its leading slash, because you’re not rewriting to
root any more. Basically, if you host your first example in a subfolder named seophp,
your .htaccessfile for the previous exercise should look like this:

RewriteEngine On
RewriteBase /seophp
RewriteRule ^my-super-product\.html$ product.php?product_id=123

RewriteRule command and its parameters must be written on a single line in
your .htaccessfile. If you split it in two lines as printed in the book, you’ll get a 500 error from the
web server when trying to load scripts from that folder.
Related Posts:
  • 5 ways to help seo Keywords in an Internet search are groups of words used to find matching web pages. One of the important aspects when concentrating on choosing and using right keywords in you web pages is not to exc… Read More
  • Description Tags on Your Website By making bold it does not differ the semantic meaning of the word, it just enhances the look and grabs the attention. Strong tag makes the word encapsulated in tags in bold. It reads louder and boldly when compared to b… Read More
  • Web Position Content is, of course, fundamental to many businesses’ search engine optimization (SEO) strategies. However, developing quality content on an ongoing basis is a challenge. Just look at the many abandoned corporate and other … Read More
  • Keywords in URLs and File Names Keywords in URLs and File Names The domain name and the whole URL of a site tell a lot about it. The presumption is that if your site is about dogs, you will have “dog”, “dogs”, or “puppy” as part of your domain … Read More
  • Search engines want natural content Search engines look at how many times a term is in your content and if it is abnormally high, will count this against you rather than for you… Read More
  • keywords on one page Don't try to optimize too many keywords on one page. Keep a narrow focus and keyword theme on a page by page basis. Perform keyword research to identify phrases used to represent your products and services. Each page optimi… Read More
  • Content Will Still Reign as King Content can attract traffic to your site but in order to keep it continue and compel the visitors to return to your site again you will need good content. It means content should be sticky. Relevant and quality content wo… Read More
  • Four Money-Making SEO Tips for Small Business Write unique content Unique content is important too. You need to provide content that has different information than what is on other sites and other Web pages. Add new content all the time (HIGH PRIORITY) Sites … Read More
  • Directory Submission There are three main search engines you have to consider for website submission: Google, Yahoo and Bing. These search giants cover more than 97% of the searches worldwide. Each one offers its own way to add the URL (or the d… Read More
  • Meta Description Keyword positioning is essential part of seo tips place it in following heads: Placing keywords in Title tag is very important part of seo tips . Title should be small and concise. 70 characters are enough for Google. K… Read More
  • Time consuming process in seo  Web site Analysis     Keyword Analysis – It includes identifying the key search terms on the basis of inventory, relevance, and competition, through which people search for your products or services. K… Read More
  • Process of Improving The Ranking Effective search engine optimization may require changes to the HTML source code of a site and to the site content. SEO tactics should be incorporated into the website development and especially into the menus and naviga… Read More
  • Analytics and Tracking You need to understand where your clicks are coming from, who is referring them, what search queries drive the most traffic and which have potential to do so as well as how many ads are being clicked on. So having a websit… Read More
  • < TITLE > Element Every page should have <title> element defined. Each page should have unique <title> describing the best, what the page has to offer. The < title> element should be less than 80 chara… Read More
  • Semantic Markup for seo HTML tags have meaning, semantic markup just means "adding meaning to your content with tags." For example, instead of formatting a headline with the <b> tag to make it bold, use a heading tag like <h2>, typicall… Read More