this is my first time with nginx rewrite, who can help me convert those rules to nginx sintax?
RewriteRule (economics|sport|gossip|aboutus)+$ index.php?section=$1
RewriteRule (register)+$ $1.php?%{QUERY_STRING}开发者_开发问答
RewriteCond %{QUERY_STRING} ^p
RewriteRule (economics|sport|gossip)/+$ articles.php?section=$1&%{QUERY_STRING}
thank you
rewrite (economics|sport|gossip|aboutus)$ /index.php?section=$1 last;
I'm not sure what the purpose of the + is in your original regex. Can there be more than one of the four words? Have you tried matching for just one of those words (i.e. is the problem the "or" part)? Why "break" instead of "last" for the rewrite directive?
rewrite (register)+$ $1.php last;
Again, I'm not sure what you're trying to accomplish with the + in this regex. Do you mean .+
(that is, "one or more of any character")? If so, the $ is superfluous. As you've written it, it means "one or more repetitions of the string 'register' ending the request string."
The rewrite syntax in nginx is not too entirely different.
rewrite ^/(.*)$ http://www.just1word.com/$1 permanent;
This is one taken from a config file that I have laying around. Perhaps it will point you in the right direction.
精彩评论