Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 隐藏的php扩展url_.htaccess_Url_Hidden_File Extension - Fatal编程技术网

.htaccess 隐藏的php扩展url

.htaccess 隐藏的php扩展url,.htaccess,url,hidden,file-extension,.htaccess,Url,Hidden,File Extension,我正在尝试隐藏我的web项目中URL的扩展文件。例如,我希望下一个URL:“local.pilarme.com.ar/owner/contacto.php”显示“local.pilarme.com.ar/owner/contacto”的方式。 我在根文件夹(local.pilarme.com.ar)中放置了一个.htaccess文件,其中包含以下内容: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUE

我正在尝试隐藏我的web项目中URL的扩展文件。例如,我希望下一个URL:“local.pilarme.com.ar/owner/contacto.php”显示“local.pilarme.com.ar/owner/contacto”的方式。
我在根文件夹(local.pilarme.com.ar)中放置了一个.htaccess文件,其中包含以下内容:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^/]+)/$ $1.php
但是,当我尝试“local.pilarme.com.ar/owner/contacto”时,会出现404错误。 我在apache 2安装中有活动的mod_rewrite:

root@rastrojero:/home/ramiro#  apache2ctl -M
Loaded Modules:
 core_module (static)
 log_config_module (static)
 logio_module (static)
 ......................
 **rewrite_module (shared)**
 setenvif_module (shared)
 status_module (shared)
Syntax OK
在站点启用文件中,我启用了AllowOverride选项:

<Directory /media/Datos/www/PilarMedicinaEstetica  >
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
</Directory>

选项索引跟随符号链接多视图
允许超越所有
命令允许,拒绝
通融

是第一次这样做。有什么想法吗?

解决了。在某些服务器中,需要指定:选项-Multiviews以不显示404错误^。Htaccess最后:

Options -Multiviews

RewriteEngine on
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php