View Single Post
  #5 (permalink)  
Old 07-28-2005, 03:44 AM
nikhiltechnology nikhiltechnology is offline
Senior Member
 
Join Date: May 2005
Location: Indore, India
Posts: 185
nikhiltechnology is on a distinguished road
iTrader: (0)
Default

Tip 2

Change a product name or change a mispelling and you've just lost all page scores to the static mod rewritten url. Unless...

Example url:
www.somesite.com/dinnerplates/cassa-stone/
Should be spelled
www.somesite.com/dinnerplates/casa-stone/


Code:
RewriteEngine On
RewriteBase /

# detect if the file being requested is a mispelling
RewriteCond %{REQUEST_URI} /.*cassa.*$
#redirect to the correct spelling using a 301
RewriteRule ^(.*)cassa(.*)$ /$1casa$2 [R=301,L]

Reg Expression notes:
.* means match any character 0 to infinite times. so .*cassa.* so zzzzcassazzzz would be a match as well as /cassa-stone/. All I'm doing is back referencing everything before and after cassa and then copying it into the new url and doing a redirect.

Benefits
This can really save your @$$ nuff said.

Tip 3

Make the unormalized, normalized for Yahoo!'s sake.

Example code:
<a href="some-directory/">some directory</a>

All bots and SE's are different. ugh. Google is very good at indexing and scoring exactly what is in the <a href> tag whether the url is normalized or not. Yahoo on the other hand is a stickler for normalization and will index the example above like so in there SERPS http://www.somesite.com/some-directory

to keep a 404 from kicking in if some-directory needs to be picked up by your mod rewrite make sure you end all your RewriteRules that end their mathcing on directory/folder like so.


Code:
RewriteRule ^([^/]+)/?$ /somepage.php?name=$1 [L]

who thought a question mark would ever be an answer
? mean match the previous character 0 to 1 times. and will fix any normalization problems you might have encountered with Y!.


Code:

#This will send you into a horrible loop and bad thing may happen
#so don't use this
RewriteRule ^(.*)$ /somepage.php?name=$1 [L]

Benefits
1. users will not hit a 404 when clicking a yahoo SERP

2. worth its weight in gold!

3. Your site will not look like a bad cloak hehe

Reguards
Nikhil
Reply With Quote