Welcome Guest, Not a member yet? Register   Sign In
Base URL not working
#1

(This post was last modified: 04-04-2018, 02:01 PM by fh361.)

New to CodeIgniter and getting my feet wet.

Have web project with older (4yr old?) CI website. Was working perfectly at previous webhosting. Moved it to new webhosting and got things set up, and now it's working but the assets are not loading due to incorrect base URL.

Per documentation, I opened application/config/config.php and changed the base URL for the new server.

Home page comes up, however, the base URL doesn't seem to be working for the site. Note. I have not made DNS changes yet, so using IP and sub-folder on the FTP.

application/config/config.php

$config['base_url'] = 'http://xxx.xxx.xx.xxx/blah.com/';

also tried

$config['base_url'] = 'http://'.$_SERVER['SERVER_NAME'].'/blah.com';

even though the URL in the browser shows

http://xxx.xxx.xx.xxx/blah.com/

the assets and stuff are trying to be loaded at

http://xxx.xxx.xx.xxx/

Here is my htaccess file.

Code:
# Deny access to the htaccess file
<FILES .htaccess>
order allow,deny
deny from all
</FILES>

# Prevent these script from executing anything
Options -ExecCGI
AddHandler cgi-script .pl .py .jsp .shtml .sh .asp .cgi

# Make it so sessions are available on all sub-domains
#php_value session.cookie_domain .prelicensetraining.com

# Prevent directory browsing
Options -Indexes

# Code Igniter Clean URL Rewrites
RewriteEngine on  
RewriteCond %{REQUEST_FILENAME} !-f  
RewriteCond %{REQUEST_FILENAME} !-d  
RewriteRule ^(.*)$ index.php?/$1 [L]  

As a side note. Was initially have trouble with a 500 internal server error on new webhosting at A2. Opened a ticket and received the following from support. Now it's connecting to db, but as I mentioned above, the base URL setting s not working properly.

"This was due to the software using an older mysql extension, which is no longer supported under PHP 7+. We installed cPanel's MultiPHP system and set blah.com to use PHP 5.6, then updated the application/config/database.php file to use 'localhost' as the database host and we now get a login page at http://xxx.xxx.xx.xx/blah.com/ ."
Reply
#2

(This post was last modified: 04-05-2018, 10:54 AM by jreklund.)

You should change your mysql settings to mysqli instead. So that you in the future can use PHP7 (you need to update all code too).

Can you show some PHP code on how you generate your assets links?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB