Forum Moderators: phranque

Message Too Old, No Replies

Mod Rewrite and placing keywords in urls

Trouble with unique id numbers

         

jonescd

8:27 pm on Mar 13, 2007 (gmt 0)

10+ Year Member



Jim,

I have had the following rewrite done for my website (this isn't actually my website but its original blank template on a test server):

<snip>

My programmer states the following:
"I have named the files name as their product ID for now, since changing it to Category or Product Name is creating a lot of errors, and lots of issues raised for the cart's various functionality.

Since Id is unique, we will have to go with it. Even in Product Details pages, it goes as per Product ID only, you cannot use name in that too, just like i could not in categories page.

It is good from SEO too, so dont worry."

My response to him was the following:

I really need the keywords to be in the urls and to have the products.php and prodetail.php silo from the categories for this rewrite to work if at all possible.

What if I manually create true static pages for the categories using the "has static page" click on my admin system from ecommercetemplates.com and following their guidelines for manually creating a static categories page. Could we then have a rewrite for products.php and proddetail.php that has the product names in the url (for example http://www.mysite.com/widget_category/widgetbrand/widget165U.htm)?

I was hoping that we could program the mod rewrite to pick of the product title (i.e., BP165U) text and place it in the url. I understand that there maybe some problem with unique id issues. Are there some ways we can work around that? For example, instead of having id numbers in the id column o fhe csv file, replacing those numbers with product text that contains keywords (i.e., replacing product id#CON14478 with Conergy Solar Panel in the csv file row). Or will all of these things still interfere with the unique id problem and thus we are stuck with never having keywords in the url?

I noticed that this website has been successful on <snip> live stores with that type of configuration: www <snip>"

Thanks,

Chris

[edited by: engine at 8:53 pm (utc) on Mar. 13, 2007]
[edit reason] Specifics, see TOS [/edit]

jdMorgan

9:28 pm on Mar 13, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your programmer isn't familiar with SEO, obviously...

A good way to do this is to store a "friendly URL" for each of the product and category pages in the database, and using the PID or CatID, look them up, and link to them on-page.

Then use a RewriteMap to handle those URLs when requested from your server. RewriteMap calls a small custom script (e.g. a PERL script) for each friendly-product-URL request (note that these URLs must be easily-identifiable by mod_rewrite) and looks up the PID/CatID from the friendly URL. It then passes this request back to mod_rewrite, which uses it to call your script with an invisible-to-the-user "unfriendly" PID/CatID-based URL.

The above requires httpd.conf or conf.d access in order to define the RewriteMap. Having defined the map, it is accessible at the server or .htaccess level.

Jim