6 Replies - 464 Views - Last Post: 12 April 2019 - 11:08 AM Rate Topic: -----

#1 YYM2019   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 09-April 19

update the different domain name while I upload files to server

Posted 09 April 2019 - 11:39 PM

Hi All,
Please help this kindergarten level PHP student.
I want to practice how to create a PHP website on my computer first, but I don't have a domain name yet. I think this will cause a problem when I upload the website from my computer to the server with the new domain name, right??
For instance:

In my computer, the website address will be like localhost/... or localhost.com or let's fake one like abc.com, so all the website pages, sub-pages and databases in my computer will be connected to those links, like abc.com/index.php, abc.com/ contact.php, etc...


Then when I upload all the pages and database to the server with a another domain name like cde.com.
How to update all the links, pages and databases to the new domain name cde.com?

I did some research like these, but I still don't get it after I read them. Please help, thanks
https://www.wpbeginn...r-to-live-site/
Do I need to install WAMPSERVER first?
Please help
Many thanks

Is This A Good Question/Topic? 0
  • +

Replies To: update the different domain name while I upload files to server

#2 andrewsw   User is offline

  • quantum multiprover
  • member icon

Reputation: 6792
  • View blog
  • Posts: 28,050
  • Joined: 12-December 12

Re: update the different domain name while I upload files to server

Posted 10 April 2019 - 12:02 AM

Quote

Do I need to install WAMPSERVER first?

Yes, you should do that. There are different versions named WAMP, XAMPP, etc..

Don't be concerned about localhost -> somedomain.com, this change happens automatically when you publish your site/files. There are plenty of sites to publish that offer free services, and a domain name, or for little cost. You can work on building and testing a site locally and decide later where you might want to host it.
Was This Post Helpful? 0
  • +
  • -

#3 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 2836
  • View blog
  • Posts: 11,132
  • Joined: 03-December 12

Re: update the different domain name while I upload files to server

Posted 10 April 2019 - 04:34 AM

View PostYYM2019, on 10 April 2019 - 01:39 AM, said:

Then when I upload all the pages and database to the server with a another domain name like cde.com.
How to update all the links, pages and databases to the new domain name cde.com?


That isn't a big deal, and you shouldn't need to change the domain name in actuality. You use relative location in the urls and they will all point to your domain, whatever it may be. An example would be,


<a href='/login'>Login</a>

vs
<a href='www.mydomain.com/login'>Login</a>


So, regardless of where it is deployed it works.
Was This Post Helpful? 1
  • +
  • -

#4 YYM2019   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 09-April 19

Re: update the different domain name while I upload files to server

Posted 10 April 2019 - 11:04 PM

Your guys are awesome!!! Thanks all your help.
Here are my understanding, so pls take a look and make any comment if you have
1. install atom and XAMPP. I configer the xampp to set the domain, but it is kind of complicated and you already tell me a better way. Anyway I post the link to whom might be interesting
https://www.youtube....h?v=4CUXwsHL2xo

2. Don't hard code this case because I can use textpad search and replace function to replace all the cde.com with the new domain name before I upload the files to the server.
I don't know why I still feel a little bit uncomfortable to do this :-)

3. Use the relative URLs. Best way for this is to use the Root-Relative URLs. But it might cause a problem when I
"rearrange your content structure. Now you've got a lot of extra QA work tracking down any broken relative links you might not have noticed while moving the content around."
can you guys explain this more?
http://www.dirigodev...olute-urls-seo/
4. Don't do anything if I use the XAMPP defulf folder structure in my computer. I think that is because the website hoster will do #2 for me. They replace the localhost with the domain name for me.

It looks like for me that 4>3>2, but I just don't know why I don't feel very comfortable. what is your experience on doing this? any idea or experience want to share? is there any concern I should have for the database?

any comment is appreciated
Thank for your help!!!

This post has been edited by andrewsw: 11 April 2019 - 12:01 AM
Reason for edit:: removed unnecessary quotes

Was This Post Helpful? 0
  • +
  • -

#5 andrewsw   User is offline

  • quantum multiprover
  • member icon

Reputation: 6792
  • View blog
  • Posts: 28,050
  • Joined: 12-December 12

Re: update the different domain name while I upload files to server

Posted 11 April 2019 - 12:04 AM

(Note that you do not need to quote previous posts each time, there is a Reply button further down the page.)

I suggest that you are overthinking this, and trying to leap/plan too far ahead. Just install XAMPP and following their basic tutorial (or another similarly basic one) and get a couple of pages up and running. I wouldn't even install Atom at this point, just use a basic text/programming editor.
Was This Post Helpful? 0
  • +
  • -

#6 YYM2019   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 09-April 19

Re: update the different domain name while I upload files to server

Posted 12 April 2019 - 12:05 AM

<?php
echo "Thanks again, will do";

?>
Was This Post Helpful? 0
  • +
  • -

#7 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6759
  • View blog
  • Posts: 31,256
  • Joined: 10-May 07

Re: update the different domain name while I upload files to server

Posted 12 April 2019 - 11:08 AM

I second what astonecipher has posted. You should use links pointing from relative root of the website, in the event that you move the site, rename the domain name, non-production vs production environments, etc.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1