Problem with nginx mod rewrite. Really appreciate help. I spent hours on that issue
Problem with rewriting url.
I want rewrite from bangots.eu/?subtopic=highscores bangots.eu/?subtopic=houses
to get this
bangots.eu/highscores bangots.eu/houses
I have this code
rewrite ^/([^/]*).html$ /?subtopic=$1 last;
and 2 things are wrong with that. 1. I dont want .html extension 2. This rewriterule take me from bangots.eu/highscores.html to bangots.eu/?subtopic=highscores. I want reverse it. Thx for any help!
That is piece of my /etc/nginx/sites-available/default
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm index.php;
# Make site accessible from http://localhost/
server_name bangots.eu;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ index.php$is_args$args =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
rewrite ^/([^/]*).html$ /?subtopic=$1 last;
}