Forum Moderators: phranque

Message Too Old, No Replies

Remove a QueryString from current page

Remove a QueryString from current page

         

barcodeuk

1:12 pm on Aug 8, 2009 (gmt 0)

10+ Year Member



Hi,

On our OSCommerce website we have products showing under different categories. There are 15 products per page and it has several pages if there are more than 15 products for that particular category.

You can use NEXT PREVIOUS and the PAGE NUMBER to navigate to any page to view the rest of the products.

When you click on the category it goes to the default page
[domain.com...]

and when you click on the page numbers

[domain.com...]
[domain.com...]
etc

When you navigate to another page to go back to the main page you have to click
[domain.com...]
and its the same page as
[domain.com...]

categorypagename.html is an autogenerated SEO URL and the URL changes if you select a different category.

1. Is it posible to remove only the " ?page=1 " from the links so that there won't be any duplicate content issues. (I don't need to remove "page=1" from any other pages such as (Orders, Customers etc in Admin)

Many Thanks

jdMorgan

1:37 pm on Aug 8, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sure, but as is always the case in these "change the URL" questions, the only way to change the URL is to edit the HTML or the script that produces the HTML -- meaning edit OSC or the SEO-friendly-URL plug-in.

The link that appears on your page defines the URL on the Web. Server-side redirects and rewrites are only after-the-fact secondary steps, and can't be used to 'change' the requested URLs.

Jim

barcodeuk

1:53 pm on Aug 8, 2009 (gmt 0)

10+ Year Member



Hi JD.

Thank you very much for your quick response.

Can I not rewrite the URL with out the "?page=1" using .htaccess.

I'm still new to URL rewrite. I'd be grateful if you could kindly explain what you meant by Server-side redirects and rewrites are only after-the-fact secondary steps, and can't be used to 'change' the requested URLs.

Many Thanks

jdMorgan

3:31 pm on Aug 8, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Please review the tutorial threads on mod_rewrite in our Apache Forum Library [webmasterworld.com]. These will give you a better understanding of the issues.

> explain what you meant by Server-side redirects and rewrites are only after-the-fact secondary steps.

In short, once the "wrong" URL is published on your Web page, and a user clicks on it, and a request for that "wrong" URL arrives at your server, your server can redirect it or rewrite it. But at that point, it is too late -- the user has already seen and clicked on that "wrong" URL, and search engines have already 'seen' and indexed the "wrong" URL.

Mod_rewrite *does not* change links on your pages, it only handles URL requests *after* the browser sends them to your server as a result of having 'seen' those links on your pages.

This "pagination" problem is widespread, and is much-discussed here at WebmasterWorld and in the forums for the various shopping carts and their plug-ins. These software vendors are slowly "learning" that they should not publish duplicate URLs and some of them are fixing this problem, but unfortunately, SEO is not their main focus, and it may be many years before they all learn not to publish more than one URL for the same page.

You need to fix your scripts. After you do that, mod_rewrite may be able to help speed up the removal of old URLs from search results, but that is all it can do for you in this case. And this will not work if your page continues to publish the "wrong" URL.

Look for the spot in the script that generates the HTML <a href="/blah?page=nn"> link after reading your database, and insert a line of code to use preg_replace or str_replace to remove "page=1" (only). Document this change and keep a backup, so you can copy that patch into any newer versions of your cart software.

Jim

g1smd

8:39 pm on Aug 8, 2009 (gmt 0)

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



This pagination problem seems to affect almost every piece of forum, blog, cart, CMS, and other scripted website software.

I despair that more than five years after we started talking about it here, and after all the coverage it has had in multiple other places, that developers still have no clue and have made no effort to fix these issues in their own products. It's not rocket science.

barcodeuk

7:41 am on Aug 10, 2009 (gmt 0)

10+ Year Member



Hi JD, g1smd,

Thanks alot for your replies.