Showing posts with label LocalHost. Show all posts
Showing posts with label LocalHost. Show all posts

Friday, 6 October 2017

How to make changes in your hosts file: Windows OS?

In some client requirements client asks to change the hosting server of websites, in those cases before making the CNAME/nameserver changes in domain settings, we made changes in the host file of local system to upload the website to new server before making everything live or making such changes in the live/production server.

To make changes in your host file in Window OS, please follow the below steps:

  1. Click on start menu and type "notepad".
  2. Right click on it notepad and select the option "Run as administrator".
  3. Now press "CTRL+O" to open the file.
  4. In file name input box copy this line "C:\Windows\System32\drivers\etc\hosts" and press enter.
  5. As the hosts file has been open now scroll till the end.
  6. At the very bottom you need to define two things, first is the IP of hosting server and second is the domain name, in our case (demonstration) I have one website running "www.amitwalia.info" which is hosted on google and one hosting which is localhost (implemented using WAMP).
  7. Now Localhost in most of the case point to "127.0.0.1" IP, in our example I will divert the www.amitwalia,info website to our localhost IP.
  8. Now in your hosts file at the very bottom first specify the new hosting server IP then mention the domain name like mentioned below.

  9. 127.0.0.1       www.example.com

  10. Now save the file and go to your browser, clear the caches and visit your www.example.com
  11. And you are done! You can also use this method to block some websites on your system.



Please find below the video demonstration of the points mentioned above as a quick review.



Read more

Sunday, 1 October 2017

Permalinks are not working in Localhost : WordPress

This issue arise mostly when you use new/different system to start your WordPress (WP) project, as sometimes the new system or the system you are using might have not selected few setting in their Apache settings. 

Due to which in your WP project if you need the website URLs other then default, it does not take you to the page instead it will through an error message on your browser screen. 

Reason behind this error message is, except default permalinks Apache server need .htaccess file to render the cusom URLs, and Apache read .htaccess file only when you have turn on the setting to read it.

And each time when you try other then default permalinks it through error and when you choose default permalinks and save it, links do start working.

To fix this issue follow the given steps:
  1. Click on Wamp icon on Window task bar.
  2. Go to Apache->Apache Modules.
  3. In the Apache module list go to "rewrite_module" and select it and you are done.
Below it the video for visual demonstration of the the above mentioned steps:




Versions at the time of Demonstration:
Operating System: Window 10
Apache server:  2.4.9 (runs through WAMP)
WordPress: 4.8.2
Read more