News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

pretty urls + nginx - SOLVED

Started by TimothyT, March 19, 2010, 12:39:28 PM

Previous topic - Next topic

TimothyT

for reference, all the url rewriting i found didn't cover the rewriting of actions such as help/manage etc, so, here's the solution for nginx i'm using now which seems to be fine. put inside a location / { ... }


# actions
rewrite ^/(activate|admin|announce|ban|boardrecount|buddy|calendar|cleanperms)/?$ "/index.php?pretty;action=$1" last;
rewrite ^/(collapse|convertentities|convertutf8|coppa|deletemsg|detailedversion|display|dlattach)/?$ "/index.php?pretty;action=$1" last;
rewrite ^/(dumpdb|editpoll|editpoll2|featuresettings|featuresettings2|findmember|help|helpadmin)/?$ "/index.php?pretty;action=$1" last;
rewrite ^/(im|jsoption|jsmodify|lock|lockVoting|login|login2|logout)/?$ "/index.php?pretty;action=$1" last;
rewrite ^/(maintain|manageattachments|manageboards|managecalendar|managesearch|markasread|membergroups|mergetopics)/?$ "/index.php?pretty;action=$1" last;
rewrite ^/(mlist|modifycat|modifykarma|modlog|movetopic|movetopic2|news|notify)/?$ "/index.php?pretty;action=$1" last;
rewrite ^/(notifyboard|optimizetables|packageget|packages|permissions|pgdownload|pm|post)/?$ "/index.php?pretty;action=$1" last;
rewrite ^/(post2|postsettings|printpage|profile|profile2|quotefast|quickmod|quickmod2)/?$ "/index.php?pretty;action=$1" last;
rewrite ^/(recent|regcenter|register|register2|reminder|removetopic2|removeoldtopics2|removepoll)/?$ "/index.php?pretty;action=$1" last;
rewrite ^/(repairboards|reporttm|reports|requestmembers|search|search2|sendtopic|serversettings)/?$ "/index.php?pretty;action=$1" last;
rewrite ^/(serversettings2|smileys|smstats|spellcheck|splittopics|stats|sticky|theme)/?$ "/index.php?pretty;action=$1" last;
rewrite ^/(trackip|about:mozilla|about:unknown|unread|unreadreplies|viewErrorLog|viewmembers|viewprofile)/?$ "/index.php?pretty;action=$1" last;
rewrite ^/(verificationcode|vote|viewquery|who|\.xml)/?$ "/index.php?pretty;action=$1" last;

# boards + topics
rewrite ^/([-_!~*'()$a-zA-Z0-9]+)/[0-9]?/?$ /index.php?pretty%3Bboard=$1.0 last;
rewrite ^/([-_!~*'()$a-zA-Z0-9]+)/([0-9]*)/[0-9]?/?$ /index.php?pretty%3Bboard=$1.$2 last;
rewrite ^/([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/[0-9]?/?$ /index.php?pretty%3Bboard=$1%3Btopic=$2.0 last;
rewrite ^/([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/([0-9]*|msg[0-9]*|new)/[0-9]?/?$ /index.php?pretty%3Bboard=$1%3Btopic=$2.$3 last;


as a note, the rewrites for the actions are enclosed in quotes because nginx really does not like the semicolon in the urls

Kill Em All

Marking solved as it is a tip.

thanks for the tip by the way.


My Site: KEAGaming.com

Manual Installation of Mods
Prevent Spam and Forum Attacks
Please do not PM or email me for support unless offered, help should be publicly displayed to others.

Cola-Coca

I did not understand you. Can you write me here step by step how to make to work "ngnix and pretty url mod" ?
I LOVE SMF

Arantor

We don't generally offer support to sites for warez here. Especially ones that are using an illegal version of SMF while they're at it.

(Evidence: site is using a version of SMF prior to SMF 2.0 final, without copyright.)

Cola-Coca

Quote from: Arantor on May 14, 2014, 09:19:05 PM
We don't generally offer support to sites for warez here. Especially ones that are using an illegal version of SMF while they're at it.

(Evidence: site is using a version of SMF prior to SMF 2.0 final, without copyright.)

I moved the signature and the web forum (warez) is not my.
I LOVE SMF

antiemp

I have my forum in a subdirectory so had to add the location to my server like this:


location /forum {
    # Rules for: actions
    rewrite ^/forum/(activate|admin|announce|attachapprove|badbehavior|buddy|buddies|calendar)/?$ "/forum/index.php?pretty;action=$1" last;
    rewrite ^/forum/(clock|collapse|coppa|credits|deletemsg|display|dlattach|editpoll)/?$ "/forum/index.php?pretty;action=$1" last;
    rewrite ^/forum/(editpoll2|refferals|emailuser|findmember|glossary|groups|guest|help)/?$ "/forum/index.php?pretty;action=$1" last;
    rewrite ^/forum/(helpadmin|httpBL|ignoretopic|im|jseditor|jsmodify|jsoption|lock)/?$ "/forum/index.php?pretty;action=$1" last;
    rewrite ^/forum/(lockvoting|login|login2|logout|markasread|mergetopics|mlist|moderate)/?$ "/forum/index.php?pretty;action=$1" last;
    rewrite ^/forum/(modifycat|modifykarma|movetopic|movetopic2|notify|notifyboard|openidreturn|pm)/?$ "/forum/index.php?pretty;action=$1" last;
    rewrite ^/forum/(post|post2|printpage|profile|quotefast|quickmod|quickmod2|rate)/?$ "/forum/index.php?pretty;action=$1" last;
    rewrite ^/forum/(recent|register|register2|reminder|removepoll|removetopic2|reporttm|requestmembers)/?$ "/forum/index.php?pretty;action=$1" last;
    rewrite ^/forum/(restoretopic|rules|search|search2|sendtopic|smstats|suggest|spellcheck)/?$ "/forum/index.php?pretty;action=$1" last;
    rewrite ^/forum/(splittopics|stats|sticky|staff|theme|trackip|about:mozilla|about:unknown)/?$ "/forum/index.php?pretty;action=$1" last;
    rewrite ^/forum/(unignoretopic|unread|unreadreplies|verificationcode|viewprofile|vote|viewquery|viewsmfile)/?$ "/forum/index.php?pretty;action=$1" last;
    rewrite ^/forum/(who|\.xml|xmlhttp)/?$ "/forum/index.php?pretty;action=$1" last;

    # Rules for: boards
    rewrite ^/forum/([-_!~*'()$a-zA-Z0-9]+)/?$ "/forum/index.php?pretty;board=$1.0" last;
    rewrite ^/forum/([-_!~*'()$a-zA-Z0-9]+)/([0-9]*)/?$ "/forum/index.php?pretty;board=$1.$2" last;

    # Rules for: topics
    rewrite ^/forum/([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/?$ "/forum/index.php?pretty;board=$1;topic=$2.0" last;
    rewrite ^/forum/([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/([0-9]*|msg[0-9]*|new)/?$ "/forum/index.php?pretty;board=$1;topic=$2.$3" last;
  }

Irisado

While this information may be useful, this topic is more than five years old and marked as solved, so it is now being locked.  Please avoid reviving old topics which have been marked as solved in future.
Soñando con una playa donde brilla el sol, un arco iris ilumina el cielo, y el mar espejea iridescentemente

Advertisement: