How to create a .htaccess file in WAMP Server

How to create a .htaccess file in WAMP Server

What is a .htaccess file?

Hypertext access (or .htaccess) file, is a Web Server configuration file, supported by several web servers, but popular with the Apache Web Server, which handles configuration changes on a directory-level without having to alter the main server config files. (In Windows, unlike Unix-based operating systems, the .htaccess file is not hidden)


Downloading the WAMP Server

In this article, we’ll use a local WAMP Server, which can be downloaded from WAMP Server’s official website or any Windows software trusted source..


Enabling htaccess

Navigate to the WAMP Server icon in Windows system tray and click the icon to generate a menu. Hover over Apache to generate an Apache menu and click on ‘httpd.conf‘.

Alternatively, navigate to your WAMP Server installation folder -like: ‘C:\WAMP_Server\bin\apache\apache2.4.39\conf\

Open httpd.conf with your favourite code editor and find the line containing the following line of code;

LoadModule rewrite_module modules/

The line might be commented or uncommented. If commented, uncomment it, and save the file to enable htaccess on your WAMP Server


Creating the .htaccess file

Now you need to create a .htaccess file in the folder that you want access to.

To achieve this in Windows you have to first create a text file with .htaccess extension, -like: ‘file.htaccess‘ [replace ‘file‘ with any name of your choice]. Without the filename, Windows will automatically take ‘.htaccess’ as the filename and add a ‘.txt‘ file extension.

Add the lines of code you want in the file.htaccess and save the file.


Note that the code won’t work still.

For the .htaccess file to work, you need to rename the ‘file.htaccess‘ to ‘.htaccess‘.

To achieve this, you can just remove the filename preceeding the .htaccess extension, or you can just use the ‘ren‘ keyword in PowerShell (PS) or Command Prompt (CMD) to rename the file to ‘.htaccess‘.

How to create a .htaccess file in WAMP Server
Hacking | thetqweb