Jump to content

nginx rewrites (mostly working, need a bit of help tho)


Michael.Terence

Recommended Posts

The announcements and downloads rewrites are working as intended, but the knowledgebase rewrites are messed up. Here's what's happening and links to the live site.

This URL should trip the first knowledgebase rewrite rule: https://my.uncorrupted.net/knowledgebase/1/DNS-Explained.html

Instead, it's hitting the second rule and using $1 as the catid and this is actually the page being displayed: https://my.uncorrupted.net/knowledgebase/1/Domain-Names

 

I've tried replacing last; with break; on the first rule, but that breaks all the rules :/

 

location /  {
                       root   /path/to/public_html/;
                       index  index.html index.php; 
                           rewrite ^/announcements/([0-9]+)/[a-z0-9_-]+\.html$ /./announcements.php?id=$1 last;
                           rewrite ^/announcements$ /./announcements.php last;

                           rewrite ^/downloads/([0-9]+)/([^/]*)$ /./downloads.php?action=displaycat&catid=$1 last;
                           rewrite ^/downloads$ /./downloads.php last;

                           rewrite ^/knowledgebase/([0-9]+)/[a-z0-9_-]+\.html$ /./knowledgebase.php?action=displayarticle&id=$1 last;
                           rewrite ^/knowledgebase/([0-9]+)/([^/]*)$ /./knowledgebase.php?action=displaycat&catid=$1 last;
                           rewrite ^/knowledgebase$ /./knowledgebase.php last;


              }

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated