Forum Moderators: buckworks

Message Too Old, No Replies

What should i use for my URL formatting?

URL Format with modrewrite

         

Turbosho

6:29 pm on Apr 26, 2010 (gmt 0)

10+ Year Member



Hey,
Right now my URL's for a product page look like this:
www.domain.com/product.asp?id=275
I can change it in my ecommerce package to either of the below. Before I didn't want to change it because I had decent ranking, I didn't want to mess with a good thing, but over the past year+ I have been pushed lower and lower and now have just a few front page listings and some 2nd page. Most are lower. It seems like most of the front page results have the product info in the URL.
Here are the options:

www.domain.com/product.asp?id=275 (CURRENT)
www.domain.com/product.asp?id=275&info=manufactuer-widget-red
www.domain.com/-product/275/manufactuer-widget-red.html

I am reaching out to the experts to see what you think I should do..

Thanks!

philbish

8:58 am on Apr 27, 2010 (gmt 0)

10+ Year Member



I just keep the URL's very short and simple. Can even remember most product url's from memory.

I just store a varchar url in the product table.

404 error page sends to processor.php which then searches DB for that varchar string, then redirects to product.php and passes the product_id it found. Plus it sends a 200 OK header to cancel out the 404 header.

So for example if you sell electronics, the URLs could be

domain.com/macbook-air
domain.com/harmon-kardon-20w-speakers
domain.com/apple-lcd-24

Turbosho

4:04 pm on Apr 27, 2010 (gmt 0)

10+ Year Member



I have read that you shouldn't change your URL structure for SEO purposes. What do you think? I look at the top 10 results for a few items that we sell in google and 9 out of them have some form of a descriptive URL instead of an ID=#*$!... Is it bad to change it this far in? My site has been up with this or similar structure for 8 years.

philbish

12:56 pm on May 2, 2010 (gmt 0)

10+ Year Member



I'd still change it if I were you.

Just make sure you don't go changing it a bunch.

Plan out what you'd like them to be and stick with it.

And you should of course do a 301 redirect from the old URL's to the new ones.

mesimoniv

4:44 pm on May 2, 2010 (gmt 0)

10+ Year Member



Given your options this is your best bet:

www.domain.com/-product/275/manufactuer-widget-red.html

g1smd

5:15 pm on May 2, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



None of the above.

www.example.com/p275-manufacturer-widget-red


Key points:
- Folder structure not necessary
- No need for word "product"
- "p" and number don't need spacing
- Remove .html extension
- Can post example.com/p275 to twitter as own URL-short.

RewriteRule ^p([0-9]+)(-([^/.]*))?$ /product.asp?id=$1&info=$3 [L]


Make sure the script checks that $3 is the right wording for that $1 value; send a 301 redirect to the canonical URL when the $3 slug wording is not correct or is missing.

jdMorgan

6:42 pm on May 2, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Philbish,

Not to take this thread off-topic, but a comment on this:

> 404 error page sends to processor.php which then searches DB for that varchar string, then redirects to product.php and passes the product_id it found. Plus it sends a 200 OK header to cancel out the 404 header.

Use of the 404 error handling for purposes of invoking scripts is rather inelegant and inefficient when a simple internal rewrite based on the requested URL will do.

But I'd like to specifically warn about the following part of your statement quoted above: "then redirects to product.php and passes the product_id"

There is no good reason to use a redirect here. The processor.php script should simply "include" the product,php script as a file (or embody it), so that the client request is handled completely within the context of the original client HTTP request. In other words, there is no reason to redirect the client, terminating the current HTTP request and requiring the client to make a second HTTP request for product.php.

I believe you will find that your site is faster and that your pages rank better if you directly serve content for the original request.

If any questions, please start a new/separate thread.

---

Turbosho,

The post immediately before this one includes a lot of very good advice resulting from extensive experience. I suggest that you read it very, very carefully, and follow up on every little detail in it.

Jim

Turbosho

1:27 pm on May 3, 2010 (gmt 0)

10+ Year Member



Thanks everyone for all the advise, I got some great ideas.
Turbosho

jdMorgan

3:42 pm on May 3, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Looking at this again in detail, the only thing I'd do differently is to move the manufacturer and product ID to the end, giving a likely-tiny keyword-position-in-URL advantage to "widget-red" which is likely the most-competitive part of the keyphrase at the cost of a little more rule-processing time:

Example: www.example.com/widget-red-manufacturer-p275

RewriteRule ^(([^-/.]+(-[^-/.]+)*)-)?(p[0-9]+)$ /product.asp?id=$4&info=$2 [L]

The rule pattern is also modified to omit the final hyphen from the "info" query string parameter, so you get id=275 and info=widget-red-manufacturer

And as noted in g1smd's previous post above, be sure to redirect the request to a corrected URL if the requested info value does not *exactly* match what is expected for the requested id number.

Jim

g1smd

8:18 pm on May 9, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If a URL in a link is malformed, it is likely that there's either something added on the end (like extraneous punctuation) or some characters missing from the end (due to clumsy cut and paste). In that case I'd not want the "
p275
" part to be the corrupted bit, as it is crucial to selecting which content is returned. That's one reason why I prefer the ID to be located immediately after the domain name and before the product text in the path part. The other reason is that simple ability to post
example.com/p275
to Twitter as your own URL-short.

There's a final reason. In Google WebmasterTools and Google Analytics, and in many other reports generated by other tools, URLs can be sorted into alphabetical order. If the ID part is located first in the path part of the URL, it becomes much easier to see exactly which URLs are indexed and where the gaps are. Duplicates are also very easy to spot. With the ID part located last in the path, this task becomes very much more difficult. This scheme likely loses a small amount of "keyword in path" benefit.