【问题标题】:How to remove index.php from url in codeigniter project如何从codeigniter项目中的url中删除index.php
【发布时间】:2017-08-10 16:46:45
【问题描述】:

我试图从托管在 azure server 上的 codeigniter 项目中的 url 中删除 index.php。如果我从 url 中手动删除 index.php,它会显示“您要查找的资源已被删除、名称已更改或正在暂时不可用。”以下是我的 .htaccess 文件

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /index.php/$0 [PT,L]

我的配置文件

$config['base_url'] = 'http://myapp.azurewebsites.net/';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

【问题讨论】:

  • 我按照上面的链接建议使用了 .htaccess,但它仍然显示“您要查找的资源已被删除、名称已更改或暂时不可用。”
  • 在您的标题中添加“在 Azure 服务器上”,人们不会这么快就投票反对

标签: php .htaccess codeigniter azure azure-web-app-service


【解决方案1】:

基本上,在 Azure Web App 中,您可以通过 Azure 门户添加 默认文档 来实现此目的。

  1. Azure Portal 中,打开 Web 应用程序的刀片。
  2. 点击应用程序设置
  3. index.php 添加到默认文档列表。

顺便说一句,Azure 使用 IIS(不是 Apache)来托管您的应用程序,因此 .htaceess 文件在 Azure Web App 中不起作用。

【讨论】:

    猜你喜欢
    • 2012-08-10
    • 2015-10-24
    • 2012-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-14
    • 2014-10-28
    相关资源
    最近更新 更多