【问题标题】:.htaccess to remove .php extenssion in not working.htaccess 在不工作时删除 .php 扩展名
【发布时间】:2015-10-15 07:39:07
【问题描述】:

在此处发布之前,我已经尝试了解决方案URL1URL2,但尚未修复。我的.htaccess 代码如下:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

在我的应用程序$_GET$_POST 中使用了htdocs 中的文件结构,如下所示:

shopping ->(main folder) css(folder) images(folder) js(folder) .htaccess file1.php file2.php : : file9.php

那么我怎样才能摆脱在 URL 中删除 .php

【问题讨论】:

    标签: php .htaccess


    【解决方案1】:
    1. 首先检查.htaccess是否被应用——see here

    2. 确保您的配置至少允许覆盖.htaccess 文件中的FileInfo(您也可以这样做AllowOverride All):

      <Directory "/var/www/html">
          AllowOverride FileInfo
      </Directory>
      

      详情请见this question

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-30
      相关资源
      最近更新 更多