繁体   English   中英

.htaccess无法在Codeigniter中使用IP地址

[英].htaccess not working with IP address in codeigniter

我正在使用Codeigniter 3.1.2。我的网址看起来像http://20.186.5.144/myproject/controller夹路径是var / www / html / myProject /

问题是没有从路由中删除index.php

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]`

以上是.htaccess配置。 我究竟做错了什么?

在config.php中设置您的基本URL

/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|   http://example.com/
|
| WARNING: You MUST set this value!
|
| If it is not set, then CodeIgniter will try guess the protocol and path
| your installation, but due to security concerns the hostname will be set
| to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise.
| The auto-detection mechanism exists only for convenience during
| development and MUST NOT be used in production!
|
| If you need to allow multiple domains, remember that this file is still
| a PHP script and you can easily do that on your own.
|
*/

$config['base_url'] = 'http://localhost/myproject/';

在实时域上时,请勿将其更改为您的域示例:

$config['base_url'] = 'http://www.example.com/';

如果未设置,则在尝试加载CSS和图像等时会遇到一些链接错误。

更多htaccess https://github.com/wolfgang1983/htaccess_for_codeigniter

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM