How to Create a. htaccess file in Windows

Source: Internet
Author: User

In windows, we know that you cannot create a file without a main file name. If you want to create a file in windows. for the htaccess file, we have to find other methods. I will summarize them below. htaccess creation methods.

The following methods:

1. There are three methods to use the DOS command:

Use the Screen Editing Command copy con. htaccess, press enter, enter the content, and press ctrl + z to complete the editing. htaccess is successfully generated;
RENAME Command ren 1.txt. htaccess. This is the most common method. commands that cannot be executed in windows are flushed in cmd;
Use the redirection command echo.>. htaccess. Enter a carriage return to. htaccess, which can be created successfully.


2. Use winrar's file manager to create a new text document, open the winrar main interface, locate the file, and rename it directly. This is when I decompress a foreign open-source project, its own. when htaccess can be decompressed correctly, you can use a manager such as 7zip.


3. Save the file directly by using a text editing tool, such as Notepad and ultraEdit. However, you can select all files when saving the file. This is really an outstanding method.

 

4. Use the file creation method in php, fopen and file_put_contents file names can be obtained directly using. htaccess.


5. Save the following code as a. bat file. Drag any file to this file icon to remove the file name and retain only the suffix.

The Code is as follows: Copy code
@ Ren "% ~ F1 ".*

Rename the RENAME command of cmd.exe:
1. @ indicates hiding the display of the command itself
2. The first parameter is the path of the source file containing the file name and suffix.
3. The second parameter indicates that the first vertex and subsequent parts of the file name and suffix are retained. If 2l's answer is a question, a.txt will be renamed as .a.txt but not. txt.

The modification is as follows (the second parameter is the suffix ):

The Code is as follows: Copy code
@ Ren "% ~ F1 "" % ~ X1"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.