Answer the question
In order to leave comments, you need to log in
How to compose a regular expression for NGINX?
Hello. Please help me with this regex.
rewrite ^/(ru|en)?/?(faq|news|page|catalogue|basket|photos|search|users)(.*)$ /?lang=$1&module=$2&mod_rewrite=$3 break;
Answer the question
In order to leave comments, you need to log in
server {
...
root /home/site/public_html;
rewrite ^/(ru|en)?/?(faq|news|page|catalogue|basket|photos|search|users)(.*)$ /index.php?lang=$1&module=$2&mod_rewrite=$3;
rewrite ^/$ /index.php;
location / { }
location ~ \.php$ {
fastcgi_pass unix:/tmp/php-fpm7.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|woff|ogg|mpe?g|avi|zip|gz|rar)$ {
add_header Pragma public;
add_header Cache-Control "public";
access_log /home/site/cache.log;
expires 1d;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question