Jump to content

Modern/Current 7.6+ NGINX rules


Recommended Posts

Hey,

Our old NGINX configuration was using this in order to rewrite URLs in a "friendly form":

rewrite ^/announcements/([0-9]+)/[a-zA-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-zA-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;

and/or

location ~ /account/announcements/?(.*)$ {
    rewrite ^/(.*)$ /account/index.php?rp=/announcements/$1;
}
location ~ /account/downloads/?(.*)$ {
    rewrite ^/(.*)$ /account/index.php?rp=/downloads/$1;
}
location ~ /account/knowledgebase/?(.*)$ {
    rewrite ^/(.*)$ /account/index.php?rp=/knowledgebase/$1;
}

Unfortunately these rules don't seem to be generally valid any more. For example "Setup -> Sign-In Integrations" is not working.

I've noticed that current/modern 7.6+ installs have a totally different .htaccess structure, as follows:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+[^/])$  $1/ [R]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
RewriteRule ^.*$ %2index.php [QSA,L]

Can anybody provide some newer NGINX rules, based on the above 7.6+ rewrites?

Thanks you!

Edited by Razva
Link to comment
Share on other sites

2 hours ago, brian! said:

@wired420 posted a thread last weekend that you might find useful....

... i've no personal experience whether it works or not, but you could update that thread either way to let others know. thanks.png

Thanks for your reply. Unfortunately that topic states the same rewrite rules (plus some general configs) as I've stated in the initial post. What we need at this point is a complete rework of the NGINX rules that were used until recently.

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