2016-11-08 52 views
1

所有人都会问“如何删除php扩展名”,但我想做出相反的处理。默认情况下,我的Apache配置从url中“隐藏”PHP扩展。也就是说,这两个网址访问相同的脚本:Apache2:如何不删除PHP扩展?

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

是否有可能“不”删除php扩展名? 我使用Ubuntu 16.04和Apache2。

这是我的.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] 
+2

告诉你的.htaccess如果你使用它 –

回答

0

只需添加下面一行到你的.htaccess文件中禁用 “在Multiviews” 功能:

Options -Multiviews