0

i want to hiding my extension like .php

but it's not only to hiding, if i enter the index.do nginx rewrite to index.php but, url address must be the same (index.do)

In summary, what I specifically want is

example.com/index.jsp,
example.com/index.html,
example.com/index.asp,
example.com/index.js,
example.com/index.do,
example.com/indexanystring[]~?&/^,
example.com/index

All must be rewritten to index.php. Additionally, the address must remain the same.

If entered as "example.com/indexanystring" url should be "example.com/indexanystring" and index.php should be visible

One of the sites I've seen seems to use nginx to implement that functionality. I think it's good from a security point of view, so I'm going to give it a try.

Below is the nginx config I tried

...
        location / {
                    try_files $uri $uri/ @rewrite;
        }
    
        location @rewrite {
                    rewrite ^ $uri.php last;
        }
    
        location ~ /roulette/index(.*)$  {
                    rewrite ^ $uri/index.php;
        }
    
        location ~ \.php$ {
                    include snippets/fastcgi-php.conf;
                    fastcgi_split_path_info ^(.+\.php)(/.+)$;
                    #fastcgi_pass 127.0.0.1:9000;
                    fastcgi_pass unix:/run/php/php5.6-fpm.sock;
                    include fastcgi_params;
        }
...

but it doesn't work as i want

Boot Re
  • 1
  • 1

1 Answers1

0

i solved it myself.

here is my setting

rewrite ^/index.* /index.php break;

but, i don't know about it is safe.

Boot Re
  • 1
  • 1