Welcome! Log In Create A New Profile

Advanced

Rewrite Pretty Url Issue

Posted by Noxim 
Rewrite Pretty Url Issue
June 18, 2014 02:54PM
Hello All,
I'm pretty new to Nginx, I have a website with a SMF forum.
I migrated from apache to nginx, installed all my mods, but since Pretty URL uses .htaccess my forum is currently unavailable.

This are the rules prettty URL wrote in the .htaccess:

RewriteBase /foro

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

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

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


And below is my Nginx Default.conf after I tried converting the rules:

# The default server
#
server {
listen MyServerIP:80;
server_name My URLS;
root /usr/share/nginx/html;
#charset koi8-r;
}
# nginx .htaccess

location /foro {
rewrite ^/(activate|admin|announce|attachapprove|buddy|calendar|clock|collapse)/?$ /./index.php?pretty;action=$1 last;
rewrite ^/(coppa|credits|deletemsg|display|dlattach|editpoll|editpoll2|emailuser)/?$ /./index.php?pretty;action=$1 last;
rewrite ^/(findmember|groups|help|helpadmin|im|jseditor|jsmodify|jsoption)/?$ /./index.php?pretty;action=$1 last;
rewrite ^/(lock|lockvoting|login|login2|logout|markasread|mergetopics|mlist)/?$ /./index.php?pretty;action=$1 last;
rewrite ^/(moderate|modifycat|modifykarma|movetopic|movetopic2|notify|notifyboard|openidreturn)/?$ /./index.php?pretty;action=$1 last;
rewrite ^/(pm|post|post2|printpage|profile|quotefast|quickmod|quickmod2)/?$ /./index.php?pretty;action=$1 last;
rewrite ^/(recent|register|register2|reminder|removepoll|removetopic2|reporttm|requestmembers)/?$ /./index.php?pretty;action=$1 last;
rewrite ^/(restoretopic|search|search2|sendtopic|smstats|suggest|spellcheck|splittopics)/?$ /./index.php?pretty;action=$1 last;
rewrite ^/(stats|sticky|theme|trackip|about:mozilla|about:unknown|unread|unreadreplies)/?$ /./index.php?pretty;action=$1 last;
rewrite ^/(verificationcode|viewprofile|vote|viewquery|viewsmfile|who|.xml|xmlhttp)/?$ /./index.php?pretty;action=$1 last;
rewrite ^/([-_!~*'()$a-zA-Z0-9]+)/?$ /./index.php?pretty;board=$1.0 last;
rewrite ^/([-_!~*'()$a-zA-Z0-9]+)/([0-9]*)/?$ /./index.php?pretty;board=$1.$2 last;
rewrite ^/([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/?$ /./index.php?pretty;board=$1;topic=$2.0 last;
rewrite ^/([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/([0-9]*|msg[0-9]*|new)/?$ /./index.php?pretty;board=$1;topic=$2.$3 last;

}
#access_log logs/host.access.log main;

location / {
index index.html index.htm index.php;
}

error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;

}

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}


Please help me out, my forum is down until I fix this.

Regards

Noxim
Re: Rewrite Pretty Url Issue
July 08, 2014 06:28AM
Did you see this post in SMF forums?
http://www.simplemachines.org/community/index.php?topic=206578.0
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 84
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready