簡體   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