Best format for pagination in clean URLs

I have a site configured with clean URLs, and I’m trying to determine the best way to add pagination to the URLs. Here are two I’m considering:

Option 1:

www.domain.com/news/page/2

Option 2:

www.domain.com/news/pg=2

Either of these formats will work with the site I’m setting up, but I just want to determine the best way to format the URL with page numbers. Any other methods I overlooked? Thanks!

t

I think the second option could be misread as a query for page 2.

What about omitting the equal sign to keep it short and clean?

www.domain.com/news/pg2

What’s a good way to parse that, with an eregi() function to pull out the “pg” and “2” parts out of that string? I used the = equal sign with explode() to easily get a key/value pair, which gives me some flexibility to create other key=value pairs.

1 Like

Sorry, my bad! :blush:

I took it you just used file paths to build the URLs, didn’t realize you were parsing them.

Oh, okay, no problem!

So do you think using /news/pg=2 is okay and no different from using /news/page/2 for pagination urls? Just not sure if there are any drawbacks or advantages to either method.

My angle was from the user perspective. I think the pg=2 is a better description of page 2 of the news article(s) than having a separate step (page) to describe it is the page 2 (2).

As a user I might assume the URL is the file path and find an extra directory to collect pages and then name them as a number to be a bit odd.

Just my two cents. I haven’t thought much of this problem before. :slight_smile:

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.