put links without file extension (.php)

前端 未结 5 1749
花落未央
花落未央 2020-12-07 21:29

Is it possible to configure Apache in order not to show a file extension?

For example: Say I have domain.com/page.php but want to have domain.com/

5条回答
  •  误落风尘
    2020-12-07 21:34

    There is also MultiViews as a vhost or .htaccess configuration option. See http://httpd.apache.org/docs/2.2/content-negotiation.html#multiviews

    From that page:

    The effect of MultiViews is as follows: if the server receives a request for /some/dir/foo, if /some/dir has MultiViews enabled, and /some/dir/foo does not exist, then the server reads the directory looking for files named foo.*, and effectively fakes up a type map which names all those files, assigning them the same media types and content-encodings it would have if the client had asked for one of them by name. It then chooses the best match to the client's requirements.

提交回复
热议问题