0

I have a CodeIgniter app working properly on my local machine using virtual hosts, and I access it via http://mysite.local

I am trying to get it to work on a different machine, where for some reason I cannot use virtual hosts, so I have to access it via http://x.x.x.x/mysite where x.x.x.x is an IP address and mysite is the folder name on the machine. The page displays, but the assets are 404. The browser is trying to retrieve, for example, http://x.x.x.x/asset.css when it's supposed to be http://x.x.x.x/mysite/asset.css

How do I change the .htaccess so that the assets are retrieved properly?

.htaccess

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

config.php

$config['base_url'] = '/';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
Obay
  • 3,135
  • 15
  • 55
  • 78

1 Answers1

0

As you mentioned I am trying to get it to work on a different machine and where x.x.x.x is an IP address and mysite is the folder name on the machine you have to set the base URL of respective machine path.

$config['base_url'] = 'http://x.x.x.x/mysite/';

Read Set up the base URL in codeigniter

Tpojka
  • 6,996
  • 2
  • 29
  • 39
Abdulla Nilam
  • 36,589
  • 17
  • 64
  • 85