最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - codeigniter base_url configuration - Stack Overflow

programmeradmin1浏览0评论

I've been exploring codeigniter for quite some time now and so far it's been good. however I am really having a hard time figuring out how base_url works here. Take for example this one $config['base_url'] = 'http://Office-Inventory/';. If I run that as http://Office-Inventory/ it will give me error 404

Not Found The requested URL was not found on this server. Apache/2.4.58 (Win64) OpenSSL/3.1.3 PHP/8.2.12 Server at dict-inventory Port 80

with this url http://office-inventory/login.

This really confuses me because if I use http://localhost:8000/, the project is actually working and i can access all controllers thru base_url or site_url.

I've been exploring codeigniter for quite some time now and so far it's been good. however I am really having a hard time figuring out how base_url works here. Take for example this one $config['base_url'] = 'http://Office-Inventory/';. If I run that as http://Office-Inventory/ it will give me error 404

Not Found The requested URL was not found on this server. Apache/2.4.58 (Win64) OpenSSL/3.1.3 PHP/8.2.12 Server at dict-inventory Port 80

with this url http://office-inventory/login.

This really confuses me because if I use http://localhost:8000/, the project is actually working and i can access all controllers thru base_url or site_url.

Share asked Mar 30 at 16:03 Vic Zoren AbucotVic Zoren Abucot 1 2
  • If localhost:8000 is working then that is your working base-url Set that in the configuration. – hakre Commented Mar 30 at 20:26
  • If your web server is not running on the standard port 80, you need to tell CI about that. The CI source shows port should be included in your base URL. A 404 at http://office-inventory/login is potentially a completely different question (eg maybe you have no login route/method/view). – Don't Panic Commented Mar 30 at 20:51
Add a comment  | 

1 Answer 1

Reset to default 0

Check your .htaccess file or create it if it doesn't exist. It should contain the following code:

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

Save it to your _codeigniter/ folder.

发布评论

评论列表(0)

  1. 暂无评论