Im trying to set up URL Rewrites for my MVC Framework but as this is the first time i have used Nginx I am having a little trouble.
I have 2 access points for my application:
/index.php
/admin/index.php
I need to route the URL for those folders / access points to the according index file, for example:
- `/admin/auth/login/` >>> `/admin/index.php?/auth/login/`
- `/contact/` >>> `/index.php?/contact/`
This is what I have so far:
#Project
server {
listen 7000;
listen localhost:7000;
location / {
root /srv/www/htdocs/ASDDL/;
index index.php;
}
location /admin/ {
root /srv/www/htdocs/ASDDL/admin/;
index index.php;
}
location ~ \.php$ {
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /srv/www/htdocs/ASDDL/$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
}
}
Now as you can see that i think the problem lies with the following line:
fastcgi_param SCRIPT_FILENAME /srv/www/htdocs/ASDDL/$fastcgi_script_name;
Where it's not routing to the admin folder because it tries to route to the root `index.php` file, can anyone shed some light on the correct way to do this?