Mod_rewrite ecommerce URL design?

Use a different suffix for different types, e. G html for products and htm for pages or something like that bags/nicebag. Html = /product.

Php? Product=nicebag&category=bags /nicebag. Html = /product.

Php? Product=nice_bag /bags = productlisting. Php?

&category=bags /contact. Htm = page. Php?

Page=contact or contact/page. Html = page. Php?

Page=contact.

Use a different suffix for different types, e. G html for products and htm for pages or something like that /bags/nicebag. Html = /product.

Php? Product=nicebag&category=bags /nicebag. Html = /product.

Php? Product=nice_bag /bags = productlisting. Php?

&category=bags /contact. Htm = page. Php?

Page=contact or /contact/page. Html = page. Php?

Page=contact.

That was my thought too. I will go with that. – Cudos Aug 31 '09 at 13:32 cheers, have a ball – Nir Levy Aug 31 '09 at 19:32.

I would use the path prefix /products/ to identify the products related URLs. So: /products/bags/nicebag. Html → /product.

Php? Product=nicebag&category=bags /products/nicebag. Html → /product.

Php? Product=nice_bag /products/bags → /productlisting. Php?

&category=bags With such a structure you could also rewrite /products/ to /productlisting. Php that then shows all products. # product listing RewriteRule ^products/$ productlisting.

Php L RewriteRule ^products/(A-Za-z0-9-_+)$ productlisting. Php? Category=$1 L # product details RewriteRule ^products/(A-Za-z0-9-_+)\.

Html$ product. Php? Prod_id=$1 L RewriteRule ^products/(A-Za-z0-9-_+)/(A-Za-z0-9-_+)\.

Html$ product. Php? Prod_id=$2&cid=$1 L # other pages RewriteRule ^(A-Za-z0-9-_+)\.

Html$ page. Php? Page=$1 L.

The idea is to avoid having "extra" keywords in the URL. Because that will maybe have some unforseen negative effects for the Search Optimization in Google. – Cudos Aug 31 '09 at 13:37.

As it will be messy and cumbersome to maintain your rewriting rules in the . Htaccess file, I would only put one rule in there, rewriting to something like: /dispatch. Php?

Request=request e.g. RewriteRule ^(.*)$ dispatch. Php? Request=$1 L,QSA In dispatch.

Php, you dissect the request into its elements (path, querystring, anchor, ...) and decide where to go from there. That way, you can use code for the decision making, which will give you a lot more flexibility than just maintaining a huge list of custom rewrite mappings. For example, you can identify product and category elements in the path by querying against your database and base the dispatch logic on the results in a more generic way.

Pseudocode if (isProduct($lastPathElement)) { // Maybe verify that leading path elements are categories ... // Other preparations/verifications ... // refer execution to product. Php } elseif (isCategory($lastPathElement)) { // Other preparations/verifications ... // refer execution to productlisting. Php } // ... (Checks for other specific stuff) else { // Static page or 404 // refer execution to page.

Php }.

This one is very good! But my existing code doesn't allow for this. I should have designed my code from this point of view first then.

– Cudos Aug 31 '09 at 13:33.

I was facing the very same issue a few weeks ago. Ended up defining a different structure for the "static" pages. Www.examples.Com/contact/ or examples.com/info/contact.html So it can be distinguished from the "dynamic" pages.

Was thinking the same. But I feels a bit clumsy to do it that way. But maybe I have to do that :( – Cudos Aug 20 '09 at 9:11.

There's pretty much no way to distinguish between examples.com/nicebag.html and examples.com/contact.html without putting non-product webpage names in . Htaccess or doing some preliminary processing in the receiving php script. As I see, the options are: rewrite all requests to page.

Php and for those that don't match any of the non-product pages, include the product script write the non-product page names to . Htaccess dynamically (messy and bug-prone) rethink the URL structure for non-product pages. Perhaps just as little as example.com/page/contact.html might help I'd go for the third one, anyway.

I would recommend flat structure: domain. Com/bags domain. Com/contact domain.Com/nice-bag.

RewriteRule ^Products/(0-9+)$ cart. RewriteRule ^Details/(0-9+)$ cart. RewriteRule ^Login/$ secure/login.

RewriteRule ^Cart/$ cart. RewriteRule ^Login/$ secure/login. RewriteRule ^Search/$/(a-zA-Z0-9+)/(0-9+)/(0-9+) cart.

RewriteRule ^Account/$ secure/account. RewriteRule ^GiftCertificate/$ cart. RewriteRule Search/$ cart.

RewriteRule ^Featured/$ featured. RewriteRule ^Billing/$ checkout. RewriteRule ^Payment/$ secure/checkout.

RewriteRule ^Checkout/$ secure/checkout. RewriteRule ^OrderSubmited/$ secure/orderSubmitted. RewriteRule ^Account/$ secure/account.

RewriteRule ^History$/ secure/account. RewriteRule ^OrderDetails/(0-9)\-(0-9+)/$ secure/account. RewriteRule ^Billing/$ secure/account.

RewriteRule ^Shipping/$ secure/acount. RewriteRule ^ChangePassword/$ secure/account. RewriteRule ^Login/$ secure/login.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions