Dha*_*hit 11 php iis codeigniter web-config
我正在遭受一个web配置文件,它不会重写我的codeigniter应用程序的url.这是web配置文件.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Clean URL" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)
这是我的网站:http: //gandhitomodi.com
我无法得到这种网址 http://gandhitomodi.com/controller/method/
例如
http://gandhitomodi.com/welcome/index/
请帮我解决这个问题.
****编辑*****
这是route.php
$route['default_controller']="welcome/index";
$route['sendmail']="welcome/send";
Run Code Online (Sandbox Code Playgroud)
这是我更改的config.php设置.
$config['base_url']="http://gandhitomodi.com/";
$config['index_page']='';
$config['url_protocal']='PATH_INFO';`
Run Code Online (Sandbox Code Playgroud)
你在这里提到这种方法吗?
这里也提到了
https://blogs.msdn.microsoft.com/azureossds/2015/09/28/convert-apache-htaccess-to-iis-web-config/
在URL重写部分下.它具有相同的.htaccess,我正在使用也有许多在线转换器,你可以尝试
首先我们需要从 url 中删除 index.php
所以在route.php中你将改变这一行
$route['default_controller'] = "welcome";
$route['404_override'] = 'notfound';
Run Code Online (Sandbox Code Playgroud)
在config.php中,您将更改该行
$config['uri_protocol'] = 'AUTO';
Run Code Online (Sandbox Code Playgroud)
之后,您需要在网站的根目录中添加.htaccess文件,如下所示:
/application
/system
/assets
/.htaccess
Run Code Online (Sandbox Code Playgroud)
并将此代码添加到.htaccess文件中
Header append X-FRAME-OPTIONS "SAMEORIGIN"
Header set Cache-Control "no-store"
Header set X-Content-Type-Options "nosniff"
Header set Strict-Transport-Security "max-age=31536000; includeSubDomains"
ErrorDocument 403 /notfound.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ollakalla
ErrorDocument 404 /index.php
</IfModule>
Run Code Online (Sandbox Code Playgroud)
然后你可以像这个例子一样访问控制器中的方法
class Reviews extends CI_Controller
{
public function latest()
{
// Some code here
}
}
Run Code Online (Sandbox Code Playgroud)
通过http://gandhitomodi.com/reviews/latest/
| 归档时间: |
|
| 查看次数: |
2572 次 |
| 最近记录: |