seferov
seferov

Reputation: 4161

Deploying and updating website

I prefer to put my projects in the localhost as http://domain.local

In addition, I use Git to push files to the remote server. The problem is that I don't want to edit the domain name on the server on each time the website is updated.

I don't think it is the right way to use http://domain.com in the localhost. What is the right way to overcome this issue?

To note, there are subdomains such as images.domain.local

Upvotes: 2

Views: 107

Answers (3)

Jiri
Jiri

Reputation: 16625

Most web frameworks store configuration for development setup and production server in separate files. Do not hardcode domain name and use such standard mechanism. You can choose between the configurations using git commit hooks, by reading machine hostname etc.

Upvotes: 2

AsTeR
AsTeR

Reputation: 7521

  • As mentioned in comments you try to use as much relative path as possible.
  • You should also try to have different environments (the production environment shouldn't be linked with your git master), deploying from git could be followed by a script that configure your production environment (look at phing if you want to have a state of the art process)
  • If you still want to do something with your commit (or pull request from production) you can use git hooks http://git-scm.com/book/en/Customizing-Git-Git-Hooks

Upvotes: 1

deceze
deceze

Reputation: 522042

Don't hardcode the domain, use $_SERVER['HTTP_HOST'] or whatever the equivalent is in your language/environment of choice to let your application dynamically figure out what domain it's running on.

Upvotes: 3

Related Questions