简体   繁体   中英

Apache2: how to NOT remove php extensions?

All people ask about "how to remove php extensions", but I want to make the opposite. By default, my Apache configuration "hides" the PHP extension from the url. That is, both urls access the same script:

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

Is it possible to "NOT" remove the php extension? I'm using Ubuntu 16.04 and Apache2.

This is my .htaccess file:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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