nginx Rewrite URL problem
I'm having a problem with the rewrite URL for nginx. It does rewrite the URL but it also changes the location of the root to the default and "Welcome to nginx!" is displayed (instead of the php/html). Here's the code I have in the conf in the sites-enabled folder:
server{
listen 80;
server_name isfollowing.co.uk;
rewrite ^/(.*) http://www.isfollowing.co.uk/$1 permanent;
access_log /var/log/isfollowing.access_log;
error_log /var/log/isfollowing.error_log;
location / {
root /srv/www/isfollowing.co.uk;
index index.php index.html index.htm;
...
...
}
Test it out at
Anyone know how I can solve this problem? Thanks!
1 Reply
server {
listen 80 default;
server_name _;
rewrite ^ http://www.$host;
}