简体   繁体   English

Apache2:如何不删除php扩展?

[英]Apache2: how to NOT remove php extensions?

All people ask about "how to remove php extensions", but I want to make the opposite. 所有人都会问“如何删除php扩展”,但我想反过来说。 By default, my Apache configuration "hides" the PHP extension from the url. 默认情况下,我的Apache配置从网址“隐藏”PHP扩展。 That is, both urls access the same script: 也就是说,两个URL都访问相同的脚本:

my/path/myscript
my/path/myscript.php

Is it possible to "NOT" remove the php extension? 有可能“不”删除php扩展吗? I'm using Ubuntu 16.04 and Apache2. 我正在使用Ubuntu 16.04和Apache2。

This is my .htaccess file: 这是我的.htaccess文件:

Options +FollowSymlinks
RewriteEngine on

# Woff type
AddType application/x-font-woff .woff

# Display PHP errors on development stage
# This line should be removed on production stage
php_flag display_errors On

# redirects all requests to index.php
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]

只需将以下行添加到.htaccess文件中即可禁用“多视图”功能:

Options -Multiviews

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM