Welcome! Log In Create A New Profile

Advanced

Problem with redirect

Posted by hellb0y77 
Problem with redirect
September 22, 2014 11:25AM
Hi, i need to make a redirect with nginx, this my file:

server {

listen 8080;
server_name test.domain.com;
index index.php index.html;
location / {
return 301 $scheme://test.domain.com/dashboard;
}
location /dashboard {
alias /path/to/my/dir;
index index.php index.html;
}
}

The problem is this, when i go to test.domain.com, the browser redirect to http://test.domain.com:8080/dashboard, it's possible to remove the "8080"?

Thanks
Re: Problem with redirect
September 22, 2014 12:05PM
Ok i resolved with:

http {

port_in_redirect off;
}

in my nginx.conf

Now have another problem, when i go to test.domain.com/dashboard, nginx insert "/dashbord" at the beginning of URL and not find any files

/var/log/nginx/access.log:

"GET /dashboard/modules/notify/module.js HTTP/1.1" 404 199 "test.domain.com/dashboard/"

Directory dashboard not exist, how can remove "dashboard" from beginning of request?
Re: Problem with redirect
September 24, 2014 03:13AM
Hi,

during all my search about another problem, i saw things like that :

return 301 $scheme://test.domain.com:80/dashboard;

it seems that you can put the the new port into the url. I did not try it, this is only thinks i saw...


HTH
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 180
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready