小编ear*_*son的帖子

升级到 Ubuntu 14.04 后无法请求没有 php 文件扩展名的 URL

将远程服务器升级到 Ubuntu 14.04 (Apache 2.4) 后,我无法使用以前的格式来请求 URI,而无需调用文件扩展名,就像在 CodeIgniter 等框架中调用页面的方式一样。

当我调用http://example.com/about时,我调用的是 about.php。这在 Ubuntu 12.04 中有效,但现在找不到页面。

这仍然适用于我的本地机器,它仍然是 12.04,所以我不认为这是 .htaccess 问题,也不认为这是站点可用的文件问题。此外,这是使用 git 控制的版本,所以除了几个调用站点名称和文件路径的 Vars 之外,一切都几乎相同。--更正:这是一个 .conf 问题,如下面我的更新中所述。

我打开了 a2enmod (mode_rewrite)。

但为了完整起见,我将同时提供 htaccess 和站点可用文件;

/etc/apache2/sites-avaialable/example.net.conf:

<VirtualHost xxx.xxx.xxx.xxx:443>
  SSLEngine On
  SSLCertificateFile /etc/apache2/ssl/domains/example.net/example.pem
  SSLCertificateKeyFile /etc/apache2/ssl/domains/example.net/example.key

  ServerAdmin webmaster@example.net
  ServerName example.net

  DirectoryIndex index.php index.html
  DocumentRoot /var/www/html/example.net/www/

  <Directory />
    Options FollowSymLinks
    AllowOverride None
  </Directory>

  <Directory /var/www/html/example.net/www>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
  </Directory>

  # Log file locations
  LogLevel warn
  ErrorLog  /var/www/html/example.net/logs/error.log
  CustomLog …
Run Code Online (Sandbox Code Playgroud)

url-routing apache-2.4 ubuntu-14.04

2
推荐指数
1
解决办法
7495
查看次数

标签 统计

apache-2.4 ×1

ubuntu-14.04 ×1

url-routing ×1