Search Marketing

   
   

How to use Apache URL Rewriting Rules

Sun Sep 30, 2007 7:59 pm
<<    
Comments: 0 Views: 463
Apache Rewrite Rules are most frequently used to rewrite url's from

domain.com/?var=somenumber

to

domain.com/somenumber

Now there are a variety of reasons to do this. Most often programmers are concerned search engines can properly spider their web pages, or in some cases people want nicer urls so that people can copy their links and distribute them across the web.

In my experience Apache Rewrite Rules are extremely useful for programming related concepts, but not so important for Search Engines or Link Copying. I have never encountered problems in google or yahoo with ? or other symbols. It is somewhat agreed though that having more than 3 variables can cause problems.

To use these features in Apache begin in your apache configuration file and look for the virtual hosts for the domain you wish to alter.

Step 1:

RewriteEngine On

Step 2:

RewriteRule ^/([^/]*) /?var=$1 [PT]

You need to form the rule based on your script's code. If your variable is customer_id then you would use

RewriteRule ^/([^/]*) /?customer_id=$1 [PT]

If you have two variables you want to rewrite then use:

RewriteRule ^/([^/]*)/([^/]*) /?var_a=$1&var_b=$2 [PT]

These examples are just guidelines you can form almost any variation for any situation.

Comments
Name:
*
URL: http: (ex. cnn.com)
Comment:
*
Number:
Math (12 + 3)
* required

© 2019 Christonium LLC

Christonium.com
|
Terms of Use
|
Privacy
ccc