question about URL's in deployment

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
greedyisg00d
Forum Commoner
Posts: 42
Joined: Thu Feb 12, 2009 2:48 am

question about URL's in deployment

Post by greedyisg00d »

Hi I am just new to web app and I am testing my application through localhost. Therefore all my links and database codes are via localhost for example:

Code: Select all

header('location:http://localhost/login.php
mysql_connect('localhost','root','')
My question is in deploying my website online do I need to change my code above since the domain name will not be localhost anymore.

Sample codes is much appreciated. Thanks
User avatar
php_east
Forum Contributor
Posts: 453
Joined: Sun Feb 22, 2009 1:31 pm
Location: Far Far East.

Re: question about URL's in deployment

Post by php_east »

the links yes, the database url no, it is usually localhost relative to the server. rarely some host use a different url for mysql but i would say 99% it is localhost.

these values you want to put in a config file or some form of configuration variable where you can change easily, and not change through the entire program again.
Post Reply