Welcome! Log In Create A New Profile

Advanced

Configure URL Rewrite for multiple root files

Posted by gigawatt 
Configure URL Rewrite for multiple root files
May 30, 2011 10:59AM
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?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 85
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