Running PHP without extension without using mod_rewrite?

前端 未结 3 2039
没有蜡笔的小新
没有蜡笔的小新 2020-12-29 11:34

Using Apache 2.2 and PHP 5, what\'s the best way to run PHP without the .php extension? For example, I have a script called app.php and I like to i

3条回答
  •  孤独总比滥情好
    2020-12-29 11:51

    An alternative is to use content negotiation. Turn on multiviews:

    Options +MultiViews
    

    If a named resource doesn't exist, Apache will glob for the file, then sort based on the media type and content encoding requirements send by the browser. If there's only one file (your PHP script), then that's what the URL resolves to.

提交回复
热议问题