Posted 17 января, 20178 yr Здравствуйте, кто знает, напомните пожалуйста, как сделать реврайт в нжинксе, чтобы например страница site.ru/page/page2?id=3 открывалась по адресу site.ru/other/3 location /other/ { rewrite ^/other/(.*)$ /page/page2?id=$1 last; } Не получается..
17 января, 20178 yr Попробуй: location /another/ { rewrite ^/another/(.*)$ /page/page2?id=$1 break; }
17 января, 20178 yr Author 56 минут назад, Silence сказал: Попробуй: location /another/ { rewrite ^/another/(.*)$ /page/page2?id=$1 break; } На главную страницу направляет
17 января, 20178 yr Так ... ? location /other/ { rewrite ^/other/(.*)$ /page/page2?id=$1 permanent; }
17 января, 20178 yr Author Заработало всё же так, ошибка была в ссылке location /other/ { rewrite ^/other/(.*)$ /index.php?app=pages&page=news?id=$1 last; } Но срабатывает только вот так site.ru/other/?id=1 А мне нужно, чтобы было так site.ru/other/1 то есть спрятать ?id= И чтоб страница site.ru/other/ открывалась как /index.php?app=pages&page=news (без гет запроса) А то пишет, что ошибка
17 января, 20178 yr location /other/ { rewrite ^/(.+)/$ /$1 permanent; rewrite ^/other/(.*)$ /index.php?app=pages&page=news?id=$1 last; }
17 января, 20178 yr Author 3 минуты назад, Silence сказал: location /other/ { rewrite ^/(.+)/$ /$1 permanent; rewrite ^/other/(.*)$ /index.php?app=pages&page=news?id=$1 last; } Неа, не работает
17 января, 20178 yr Последний Вариант: location /other/ { rewrite ^/other/(.*)/id/$ /index.php?app=pages&page=news?id=$1 last; }
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.