![](/img/trans.png)
[英]remove index.php from URL in codeigniter in windows azure
[英]Remove index.php file from url codeigniter didn't work in Windows server
How to remove index.php from windows server 从这里找到答案
尝试了以下方法。
1.在我的codeigniter项目的根目录中创建一个名为web.config
的文件。
2.将以下内容放入其中
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rule" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
但它对我不起作用。
您可以尝试以下步骤:
打开文件夹“application/config”并打开文件“config.php”。 在 config.php 文件中找到并替换以下代码。
//find the below code
$config['index_page'] = "index.php"
//replace with the below code
$config['index_page'] = ""
然后找到如果你有代码$config['uri_protocol'] = "AUTO"
更改为$config['uri_protocol'] = "REQUEST_URI"
你的web.config
内容应该没问题,修改文件时需要重启Azure Web Apps Server。
从 url 中删除 index.php 是必须使用 htaccess 完成的事情,转到应用程序的根目录并创建一个名为“.htaccess”的新文件并输入以下内容:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.