Try this:
- It redirects
/group.php
to/group/
- Rewrite everything in /group/ to /group/group.php
This assumes group.php
exists in /group/group.php
.
rewrite ^/group\.php$ /group/ redirect;
rewrite ^/group/ /group/group.php last;
Pergunta
I am currently battling with the existing documentation of the rewrite rule in nginx. I have a hard time finding anyone else who have done this aswell.
What I want is rather simple. When I visit http://mypage.com/group.php I want to be redirected to http://mypage.com/group/. I want it to read group.php ofcourse when I visit /group/
I've played around a bit with locations in my server config but never got it to work.
location /group/ {
rewrite ^/group(.*) group.php
}
I can't seem to get this rule.
Solução
Try this:
/group.php
to /group/
This assumes group.php
exists in /group/group.php
.
rewrite ^/group\.php$ /group/ redirect;
rewrite ^/group/ /group/group.php last;