base url

i have a php that have a base url config  $config['base_url'] = '';
when i request the url from server ip its work put when i make it by domain name it's redirect to ip again.
i trye to change base url to $config['base_url'] = '/'; the site is opening but the css and images is not working.
i run my web application under wamp
so where is the problem ?
Amin El-ZeinAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Olaf DoschkeSoftware DeveloperCommented:
Nobody can say that without knowing the script and how $config['base_url'] is used. File commands will work with file system paths, eg root'/', but base_URL points out it will need a base URL, that's ip or an http URL.not a path in the file system.

Bye, Olaf.
Julian HansenCommented:
Please render the home page and post the HTML here. I suspect that the base url config value is being used to set the following in your HTML document
<base href="..." />

Open in new window

To answer this question we need to know.
1. What your web_root path is - is it just a domain or is it a sub-folder of the domain
2. How is your WAMP configured with respect to this domain - is there a VHOST entry for it and if so what does that look like.
3. Does your project use a .htaccess file - if so what does that look like.
Amin El-ZeinAuthor Commented:
RL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
| 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'] = '';
Julian HansenCommented:
Ok some key things jump out
1. You are using CodeIgniter
2. Typically this will be your base URL, and they give an example
3. WARNING: You MUST set this value!

So based on the above try setting it to

Open in new window

Obviously substituting the above with your actual domain name.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Olaf DoschkeSoftware DeveloperCommented:
As you use WAMP, so Windows, you typically will not have a domain, then it's simply http://localhost/, but that might be the webroot for XAMPPs or WAMPs default interface, then depending on where you installed the root address might be a subfolder http://localhost/myfirstcodeignitersite/ and/or you need some other port than 80, if that's already used by IIS, eg http://localhost:81/ or http://localhost:8000/.

But actually, you should know yourself. If you're new to web development I suggest after installing WAMP you first get a simple PHP script up and running:
<?php phpinfo(); ?>

Open in new window

You have to know the root folder for WAMP to see where to put that as info.php file and then call it via a browser pointed to the URL http://localhost/info.php.

Bye, Olaf.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.