简体   繁体   English

如何在IP地址而不是域名上运行Codeigniter?

[英]How to run Codeigniter on IP address instead domain name?

I tried to start Codeigniter in IP address instead domain name: 我尝试在IP地址而不是域名中启动Codeigniter:

So, I have configuration: 所以,我有配置:

$config['base_url'] = 'http://152.80.141.23/';

And routing: 和路由:

$route['recovery'] = 'registration/recovery';

When I try to call route: http://152.80.141.23/recovery 当我尝试呼叫路由时: http://152.80.141.23/recovery : http://152.80.141.23/recovery

I get error: 我得到错误:

Not Found

The requested URL /recovery was not found on this server.

Htaccess is: Htaccess是:

AddDefaultCharset utf-8
RewriteEngine On

RewriteBase /
DirectoryIndex index.php
Options All -Indexes

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]

<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

My latest config file is: 我最新的配置文件是:

$config['base_url'] = 'http://'.$_SERVER['HTTP_HOST'].'/';
$config['site_lang_url']    = '';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';

Try this in .htaccess file : 在.htaccess文件中尝试一下:

RewriteEngine On

# Put your installation directory here:
# If your URL is www.example.com/, use /
# If your URL is www.example.com/site_folder/, use /site_folder/


# Do not enable rewriting for files or directories that exist
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# For reuests that are not actual files or directories,
# Rewrite to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [PT,L]  

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

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