Jump to content

Recommended Posts

This is more of an SEO question. 

I have a site with couple hundred categories within each city. I was wondering what the best approach is to do them?

www.mysite.com/browse/apples?city=new-york

www.mysite.com/browse/new-york?category=apples

Which one is the better way to do it for seo purposes? 

If it's the first method, that would mean I would have to create couple hundred pages for those categories yes?

SEO doesn't care about the URL. It's a myth.

The second one looks better.

Either way you never create "hundreds of pages". Every single one should use URL rewriting to go through a single PHP script. For example, you can tell your web server that /browse/thing should map to /browse.php?city=thing (and append the ?category=apples). Then all you need is the single file to handle everything.

5 hours ago, requinix said:

SEO doesn't care about the URL. It's a myth.

The second one looks better.

Either way you never create "hundreds of pages". Every single one should use URL rewriting to go through a single PHP script. For example, you can tell your web server that /browse/thing should map to /browse.php?city=thing (and append the ?category=apples). Then all you need is the single file to handle everything.

Really? That's how I had it originally but now I changed it to have a separate page for each city. Guess I'll change it back.

Second question, is it okay to have an ID of a city and category as oppose to the name in the URL? Like this.

/browse.php?city=123&category=456

Having an ID would make it a lot easier to retrieve data.

Edited by imgrooot
33 minutes ago, imgrooot said:

Really? That's how I had it originally but now I changed it to have a separate page for each city. Guess I'll change it back.

 

Answer it this way:

What is the hierarchy of the actual data?
/browse/apples?city=new-york suggests the person is browsing apples and wants to see the ones for New York.
/browse/new-york?category=apples suggests the person is browsing things about New York and wants to see the ones about apples.

Only one of those should make sense - or at least make noticeably more sense than the other.

 

33 minutes ago, imgrooot said:

Second question, is it okay to have an ID of a city and category as oppose to the name in the URL? Like this.

/browse.php?city=123&category=456

Having an ID would make it a lot easier to retrieve data.

...which is why sites use IDs. But labels are nice for people to read (SEO doesn't care about URLs but humans do), which is why sites don't use just the IDs but also the labels too.

Such as /topic/311294-do-i-have-to-create-a-new-page-for-every-single-category/

Use the ID, but verify that the rest of it matches (and redirect if it does not).

22 minutes ago, requinix said:

 

Answer it this way:

What is the hierarchy of the actual data?
/browse/apples?city=new-york suggests the person is browsing apples and wants to see the ones for New York.
/browse/new-york?category=apples suggests the person is browsing things about New York and wants to see the ones about apples.

Only one of those should make sense - or at least make noticeably more sense than the other.

 

...which is why sites use IDs. But labels are nice for people to read (SEO doesn't care about URLs but humans do), which is why sites don't use just the IDs but also the labels too.

Such as /topic/311294-do-i-have-to-create-a-new-page-for-every-single-category/

Use the ID, but verify that the rest of it matches (and redirect if it does not).

 

1. What I meant was that originally I had a single browse.php page and included cities as parameters. For e.g. /browse.php?city=new-york. So I changed it to having each city as a separate page like /browse.php/new-york.php. So I am asking if I should leave it as is or change it back?

 

2. I am using IDs to retrieve the results from the database. If a city parameter ID is ''123", I can grab it form the url and search all the records in that city from the database. Isn't that how it's suppose to be done?

If I use both, it would look like this. /browse.php?city=new-york&id=123.  I don't know how to do pretty urls so I can't make it like your example.

Edited by imgrooot
38 minutes ago, imgrooot said:

1. What I meant was that originally I had a single browse.php page and included cities as parameters. For e.g. /browse.php?city=new-york. So I changed it to having each city as a separate page like /browse.php/new-york.php. So I am asking if I should leave it as is or change it back?

One browse.php that handles /browse/whatever.

 

Quote

2. I am using IDs to retrieve the results from the database. If a city parameter ID is ''123", I can grab it form the url and search all the records in that city from the database. Isn't that how it's suppose to be done?

If I use both, it would look like this. /browse.php?city=new-york&id=123.  I don't know how to do pretty urls so I can't make it like your example.

browse.php?city=123

If the page is valid (city #123 exists) then the next step is to figure out what the canonical URL for the page should be. Namely /browse/city-name. If there's a category then that too, which you can handle as just ?category=123 because people don't care about query strings.
If the canonical URL does not match the actual URL then redirect.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.