URL masking - making it prettier/SEO, w/E - QUESTION???

Discuss practical ways rearrange URLs using mod_rewrite.

URL masking - making it prettier/SEO, w/E - QUESTION???

Postby rnc505 » Wed Jan 14, 2009 4:28 pm

http://www.*******.com/cgi-bin/shopper. ... t+Scale%22

This is my before URL (I've removed the domain name so my own reasons).

I want to make it:

http://www.*******.com/Weight_Scale.html (or Weight-Scale.html)

I got it to the point of:
http://www.******.com/%22Weight+Scale%22.html

with the ModRewrite code of:

Code: Select all
RewriteEngine On
RewriteRule ^([^_]*)\.html$ /cgi-bin/shopper.cgi?search=action&keywords=$1 [L]


How do I get it to /Weight_Scale.html ?

THANKS EVERYONE!
rnc505
 
Posts: 1
Joined: Wed Jan 14, 2009 4:23 pm

Postby richardk » Thu Jan 15, 2009 3:37 am

Will %22 always be included around the search keywords?

To include a % in the new URL you need to escape it (\%) as it is used for RewriteCond variables (like $ is for RewriteRules). Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^([^/]+)\.html$ /cgi-bin/shopper.cgi?search=action&keywords=\%22$1\%22 [L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 17 guests

cron