I have this rules that sucessfully worked on apache but return error or nginx :
rewrite ^/saison-([0-9]{1})$ /pages.php?cat_page=saison-$1&season=$1 last;
rewrite ^/saison-([0-9]{1})/([a-z0-9-]+)$ /evenements.php?season=$1&title=$2 last;
rewrite ^/saison-([0-9]{1})/([a-z0-9-]+)/([a-z0-9-]+)/([a-z0-9-]+)$ /evenements.php?season=$1&title=$2&place=$3&date=$4 last;
rewrite ^/saison-([0-9]{1})/([a-z0-9-]+)/([a-z0-9-]+)/([a-z0-9-]+)/([a-z]+)$ /evenements.php?season=$1&title=$2&place=$3&date=$4&view=$5 last;
I got :
*Restarting nginx: [emerg]: directive "rewrite" is not terminated by ";" in /path/rwrules.nginx:1
If I remove this 4 lines from my rewrite rules, it works. What's the problem ?
Read this documentation. especially:
Note: for curly braces( { and } ), as they are used both in regexes and for block control, to avoid conflicts, regexes with curly braces are to be enclosed with double quotes (or single quotes).
So for example the line :
rewrite ^/saison-([0-9]{1})$ /pages.php?cat_page=saison-$1&season=$1 last;
should be:
rewrite "^/saison-([0-9]{1})$" /pages.php?cat_page=saison-$1&season=$1 last;
This should remove the ";" syntax error (for the rule I didn't check they are functionnaly valid).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With