Welcome to Centmin Mod Community
Become a Member

I want to rewrite these urls

Discussion in 'Ecommerce / Shopping cart usage' started by knguyen2015, Mar 3, 2018.

  1. knguyen2015

    knguyen2015 New Member

    11
    1
    3
    Aug 27, 2017
    Ratings:
    +1
    Local Time:
    12:25 AM
    1.12.1
    15.1
    I just want to rewrite the url like this:


    /?taxonomy=product_shipping_class&term=additional-item/page/4/ -> /page/2/?taxonomy=product_shipping_class&term=additional-item

    I tried many times but no luck.
     
  2. eva2000

    eva2000 Administrator Staff Member

    53,211
    12,113
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,650
    Local Time:
    2:25 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    looks like shopping cart of some kind ? what web app ? usually web apps have their own friendly url support ? have you asked if they support nginx rules ?

    post the example nginx rewrite rules you have tried

    for posting code you might want to use CODE tags for code How to use forum BBCODE code tags :)
     
  3. knguyen2015

    knguyen2015 New Member

    11
    1
    3
    Aug 27, 2017
    Ratings:
    +1
    Local Time:
    12:25 AM
    1.12.1
    15.1

    Thanks for your response. Here is my rule:

    Code:
    rewrite ^/?taxonomy=product_shipping_class&term=(.*)/page/(.*)$ /page/$2/?taxonomy=product_shipping_class&term=$1 last;
     
  4. eva2000

    eva2000 Administrator Staff Member

    53,211
    12,113
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,650
    Local Time:
    2:25 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    that won't work as your url has arguments taxonomy=, term= etc

    You might want to ask web app's developers for suggestions for more friendly url formats. Generally, you wouldn't want to get too customised for such as it will make future upstream changes or even web server changes more difficult to keep in sync with. Also how a url looks doesn't mean much these days as alot of browsers may not show the full url i.e. on mobile devices' web browsers. The end user doesn't care or even pay attention to full urls most of the time.