I'm trying something I thought would be fairly simple: namely, to redirect domain.com/dashboard/
to another (different) application than my main domain, (which is a wordpress install, but that's fairly irrelevant I think).
So when visiting domain.com/dashboard/anywhere
, this second application should act as if /dashboard/
was the route of the domain, and process all urls etc as normal.
What I have tried so far either just causes a redirect loop, doesn't route at all or gives a 500 error.
Here's an example of my nginx location for this so far:
location ~ ^/dashboard/
{
alias /srv/www/htdocs/fork/; // this is the second application I want to access
rewrite "^(/.*)$" http://domain.com/$1 permanent;
index index.php index.html;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
break;
}
I've tried switching from alias
to root
also, but to no avail. And I'm not really sure what to try next.
Does anyone have any idea about what could be causing the redirect? (Essentially causing a loop of domain.com/dashboard/dashboard/dashboard
(etc).
Update
Okay, so following Mark's advice below, I've moved the location block above any wordpress rules, and I've commented out some code. Progress has been made in that now a request to domain.com/dashboard/
will access the right application, but it's now looking in that application for a dashboard
folder.
Here's the current code:
location ~ ^/dashboard(/)(.*)$
{
root /srv/www/htdocs/fork/;
break;
}
and the current error in the logs is "/srv/www/htdocs/fork/dashboard/index.php" is not found
(what I'm after is it accessing /srv/www/htdocs/fork/index.php
.