Table of Contents
Articles you may be interested in
Home Backend Development PHP Tutorial How to edit the host file quickly and easily_PHP tutorial

How to edit the host file quickly and easily_PHP tutorial

Jul 13, 2016 am 10:30 AM
host file fast edit

When developing web programs, we sometimes do this, which is to modify the hosts file to do virtual domain name mapping to facilitate local development. For example, point the domain name www.phpernote.com to the local 127.0.0.1. This operation process itself is not complicated at all, but in the Windows environment, the hosts file is hidden very deep, so every time we have to Baidu the hosts file path and then open the file directory layer by layer to find the file. If you change it frequently, it will be really troublesome, so here I have summarized a relatively good and slightly masterful method to share.

(1) Use text editing software such as Notepad to write the following code:

::去除hosts文件只读属性
attrib -R C:\windows\system32\drivers\etc\hosts
::用notepad编辑hosts文件
notepad C:\windows\system32\drivers\etc\hosts
::给hosts文件加上只读属性
attrib +R C:\windows\system32\drivers\etc\hosts
Copy after login

Then save the file as a .bat file with a suffix name (for example: hosts.bat).

(2) Place the file into the WINDOWSsystem32 directory. In fact, it does not have to be placed in this directory. You can create a new directory anywhere and copy the full path of the directory. Just go to the environment variables of the Windows system.

OK, two simple steps. If you need to modify the hosts file in the future, just enter hosts directly during operation. After pressing Enter, the system will automatically make the hosts file writable, then open the hosts file and wait for the editing to be completed. When exiting, the file will automatically become read-only.

Articles you may be interested in

  • Use PHP's GZip compression function to compress website JS and CSS files to speed up website access
  • bat batch Processing and modifying the host file
  • Javascript implementation of string interception function summary (including the introduction of using Js to intercept Chinese characters)
  • jquery to determine whether the page has loaded the jquery file
  • Use Google It will be better to load the jquery library file
  • PHP uses Curl Functions to realize multi-threaded web crawling and downloading files
  • PHP is the safest and most realistic solution to determine the uploaded file type
  • Location of hosts file and how to open hosts file

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/764185.htmlTechArticleWhen developing web programs, we sometimes do such an operation, which is to modify the hosts file to do virtual domain name mapping. Convenient for local development, for example, point the domain name www.phpernote.com to the local...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to edit documents in Tencent Docs? -Tencent Document Editing Document Tutorial Guide How to edit documents in Tencent Docs? -Tencent Document Editing Document Tutorial Guide Mar 19, 2024 am 08:19 AM

Does anyone know how to edit documents in Tencent Docs? It doesn't matter if you don't know. Today, the editor will introduce detailed graphic explanations on how to edit documents in Tencent Docs. I hope it can help you. Detailed graphic explanation of editing documents in Tencent Documents 1. First, enter Tencent Documents directly (if you don’t have it, download it now!) and log in directly (QQ and TIM two login methods are supported) 2. After logging in, click Add in the upper right corner No., directly create online documents, online forms, new folders, etc.! 3. Then enter the information according to your needs!

How to restore the deleted hosts file How to restore the deleted hosts file Feb 22, 2024 pm 10:48 PM

Title: How to restore the hosts file after deletion Summary: The hosts file is a very important file in the operating system and is used to map domain names to IP addresses. If you accidentally delete the hosts file, you may be unable to access certain websites or have other network problems. This article will introduce how to recover accidentally deleted hosts file in Windows and Mac operating systems. Text: 1. Restore hosts file in Windows operating system. Hosts file in Windows operating system

Understand the differences and comparisons between SpringBoot and SpringMVC Understand the differences and comparisons between SpringBoot and SpringMVC Dec 29, 2023 am 09:20 AM

Compare SpringBoot and SpringMVC and understand their differences. With the continuous development of Java development, the Spring framework has become the first choice for many developers and enterprises. In the Spring ecosystem, SpringBoot and SpringMVC are two very important components. Although they are both based on the Spring framework, there are some differences in functions and usage. This article will focus on comparing SpringBoot and Spring

How to edit home screen pages on iPhone How to edit home screen pages on iPhone Feb 14, 2024 pm 02:00 PM

Apple allows you to quickly change your home screen by rearranging your home screen pages at any time and deleting them freely. This way, you can easily hide multiple apps and widgets without dragging and deleting them one by one. In this article, we will explain how to edit pages on your iPhone home screen. CONTENTS[SHOW] Shows how to edit Home screen pages on iPhone You can edit the Home screen to rearrange pages, hide/unhide certain pages in the Home screen, and delete pages completely. To start editing your iPhone home screen, press and hold an empty area on your home screen. When your home screen enters jitter mode, tap the row of dots at the bottom of the screen. You should now see all your home screens displayed in a grid format. Option 1: On the home screen

What to do if word document cannot be edited What to do if word document cannot be edited Mar 19, 2024 pm 09:37 PM

After editing the document, we will save the document to provide convenience for editing and modifying the document next time. Sometimes we can modify it directly after clicking on the edited document, but sometimes for some unknown reason, there is no response no matter how we click on the word document, and the command will not be executed. , what should I do if the word document cannot be edited? Don’t worry, the editor will help you solve this problem. Let’s take a look at the operation process. After opening a Word document, when editing text, you will see a "Restrict Editing" prompt displayed on the right side of the page, as shown in the figure below. 2. You need to cancel editing and you need to know the set password. Click "Stop Protection" below the pop-up prompt, as shown in the figure below. 3. Then enter the password in the "Unprotect Document" dialog box and click OK, as shown in the figure below.

What is the difference in the 'My Computer' path in Win11? Quick way to find it! What is the difference in the 'My Computer' path in Win11? Quick way to find it! Mar 29, 2024 pm 12:33 PM

What is the difference in the "My Computer" path in Win11? Quick way to find it! As the Windows system is constantly updated, the latest Windows 11 system also brings some new changes and functions. One of the common problems is that users cannot find the path to "My Computer" in Win11 system. This was usually a simple operation in previous Windows systems. This article will introduce how the paths of "My Computer" are different in Win11 system, and how to quickly find them. In Windows1

Lifecycle functions in Vue3: Quickly master the lifecycle of Vue3 Lifecycle functions in Vue3: Quickly master the lifecycle of Vue3 Jun 18, 2023 am 08:20 AM

Vue3 is currently one of the most popular frameworks in the front-end world, and the life cycle function of Vue3 is a very important part of Vue3. Vue3's life cycle function allows us to trigger specific events at specific times, enhancing the high degree of controllability of components. This article will explore and explain in detail the basic concepts of Vue3's life cycle functions, the roles and usage of each life cycle function, and implementation cases, to help readers quickly master Vue3's life cycle functions. 1. Vue3’s life cycle function

The specific method of editing vertical subtitles in Edius The specific method of editing vertical subtitles in Edius Mar 28, 2024 pm 02:52 PM

1. Make preparations. Import a piece of material into the material library and drag it to the timeline. 2. Click the [T] button on the timeline track, choose to add subtitles on the 1T track, and you will enter the subtitle editing page. The operation is as shown in the picture: 3. Here you can write the text content we want. It is obvious that the subtitles are written horizontally. Now let’s take a look at how to implement vertical subtitles. Don't write the content yet, select [Insert - Text - Vertical] as shown in the picture: 4. Now write the words and it will be arranged vertically. After adjusting the position, size, font, color and other information of the subtitles, click Save in the upper left corner of the window.

See all articles