nginx, wont go to index


Recommended Posts

hello!

 

I am trying to get my nginx to go to index.php if on the root URL (www.example.com).

 

at the moment this is my location /

 

as you can see I rewrite anything with view.php as its exstention... I can visit index.php but it wont display by default... any help?

        location / {
                #limit_rate 512k;
                root   /var/www;
                index  index.php;
                client_max_body_size 20M;
                try_files $uri $uri.php =404;
                if (!-e $request_filename){
                        rewrite ^(.*)$ $1.view.php;
                }
        }

Link to comment
Share on other sites

yea cheers I got it working needed to do an = / (which I had never seen used before ) either way its all gravy now :)

 

 

In your nginx.conf change default_type to text/html and then change index to index.php index.html;

 

Heres some resources:

 

http://nginx.org/en/docs/http/ngx_http_core_module.html#default_type

http://nginx.org/en/docs/http/ngx_http_index_module.html#index

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.