Convert htaccess to nginx
htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-zA-Z0-9-]+)/?([a-zA-Z0-9-]+)?/?([0-9]{1,2}.[0-9]{2,3})?/?$ index.php?l=$1&s=$2&c=$3&q=%{QUERY_STRING}
nginx
location / {
if (!-e $request_filename){
rewrite "^/([a-zA-Z0-9-]+)/?([a-zA-Z0-9-]+)?/?([0-9]{1,2}.[0-9]{2,3})?/?$" /index.php?l=$1&s=$2&c=$3&q=$query_string;
}
}
1 Reply
I think this will work, but it's been awhile since I've used Nginx:
location / {
try_files $uri $uri/ @router;
}
location @router {
rewrite "^/([a-zA-Z0-9\-]+)/?([a-zA-Z0-9\-]+)?/?([0-9]{1,2}\.[0-9]{2,3})?/?$" /index.php?l=$1&s=$2&c=$3&q=$query_string;
}