329: How to configure PrestaShop 1.5 with a Temp URL
Many people may want to build a new website while maintaining an existing one. An important reason for doing this is to be able to view and test the new site to ensure it will run correctly once the domain name is pointed to it. In many cases, the site owner may try to use a "Temp URL", which is a URL that is used to view a site when the proper domain name is not pointed to it. It is typically long and usually contains a servername or number, and a username. They can appear quite cryptic and are typically only used for testing purposes.
Complex programs, such as PrestaShop, are reliant on the URL. This information is usually stored in more than one place, such as configuration files and one or more database tables, making it difficult to change from the Temp URL to the real domain name when the time comes.
Using a "Temporary URL" also may not be the best option due to the way a server, particularly an Apache server, reads path structures for things such as images, and CSS configuration files. If using a Temp URL, these may not work at all. Finally, there are many redirects that can affect areas such as admin logins, causing them not to work properly over a Temp URL.
While you may be able to modify settings and code to work well with the Temp URL, you will then need to undo all the settings once you point the domain to your new site.
There is another option that prevents all the back and forth work. This is known as a hosts file modification. Below are the steps to changing your hosts file to allow you to view your new website just as it would be if you already had your domain name pointed to it.
Be sure to back up the file onto a USB drive or copy it to another directory in case you need to restore it later.
Modifying your hosts file in Windows
Your hosts file will be in different places, denending on the version of Windows you are running:
- Windows 95/98/Me c:\windows\hosts
- Windows NT/2000/XP Pro c:\winnt\system32\drivers\etc\hosts
- Windows XP Home/Vista/Windows 7 c:\windows\system32\drivers\etc\hosts
Once you have located the file, open it in a text editor such NotePad. If you get a permissions error during the process, please check the link below for assistance:
Your hosts file should appear something like the example below:
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
# For example:
# 126.96.36.199 rhino.acme.com # source server
# 188.8.131.52 x.acme.com # x client host
Modifying your Hosts file on a Mac
Changing your hosts file on a Mac must be done as the 'root' user in the Terminal application. Below are the steps you will need to take.
- Open the Mac's Terminal application.
- Open the hosts file for editing. From the Terminal window, paste the code below intot he command string and hit Return.
sudo nano /private/etc/hosts
- Edit the host by adding the following two lines to the end of the file:
184.108.40.206 YourRealDomainName.comBe sure to use your servers's shared IP address and your actual domain name.
- Save the changes to your file by pressing Control-o on the keyboard and then hit Return.
- You may need to flush your Mac's DNS cache to see immediate changes. To do so copy the following code into the Terminal program and hit Return
We value your feedback!
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
Post a Comment
Do you want to publish a tutorial to our support center?