[.htaccess] How to use .htaccess in WAMP Server?

I searched in web for 2 days and I try to use htaccess in my local wamp but I can't! I know there is something wrong but I don't know where...

First: I activated "rewrite_module" in the apache menu, then I checked the phpinfo page and I saw that module added to its "Loaded Modules" part.

Second: I checked the httpd.conf and made some changes, it is the result (just important parts):

ServerRoot "c:/program Files/wamp/bin/apache/apache2.2.11"
Listen 80
ServerName localhost:80
DocumentRoot "c:/program Files/wamp/www/"

<Directory />
Options FollowSymLinks
# AllowOverride None
# Order deny,allow
# Deny from all
AllowOverride all
Order Allow,Deny
Allow from all
</Directory>

<Directory "c:/program Files/wamp/www/">
Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all
</Directory>

LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so

Next: I made an alias to my workspace. Here is contents of its .conf file:

Alias /basic_test/ "e:/Projects/basic_test/"

<Directory "e:/Projects/basic_test/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
Allow from all
</Directory>

Next: I place a simple "index.php" and "test.php" in my workspace root and tested the alias by this addresses: --> "localhost/basic_test/index.php" --> "localhost/basic_test/test.php" They worked perfectly...

Finally, I added a ".htaccess" file to the root of my workspace (beside index.php), and I wrote in it:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^index.php$ test.php
</IfModule>

But the problem occurred when I tried to test the ".htaccess" by this address: --> "localhost/basic_test/index.php"

It shows an error page with this message:

Oops! This link appears to be broken.

This question is related to .htaccess mod-rewrite wampserver

The answer is


Click on Wamp icon and open Apache/httpd.conf and search "#LoadModule rewrite_module modules/mod_rewrite.so". Remove # as below and save it

LoadModule rewrite_module modules/mod_rewrite.so

and restart all service.


if it related to hosting site then ask to your hosting to enable url writing or if you want to enable it in local machine then check this youtube step by step tutorial related to enabling rewrite module in wamp apache https://youtu.be/xIspOX9FuVU?t=1m43s
Wamp server icon -> Apache -> Apache Modules and check the rewrite module option it should be checked Note its very important that after enable rewrite module you should require to restart all services of wamp server


click: WAMP icon->Apache->Apache modules->chose rewrite_module

and do restart for all services.


Open the httpd.conf file and search for

"rewrite"

, then remove

"#"

at the starting of the line,so the line looks like.

LoadModule rewrite_module modules/mod_rewrite.so

then restart the wamp.


Examples related to .htaccess

Use .htaccess to redirect HTTP to HTTPs Getting a 500 Internal Server Error on Laravel 5+ Ubuntu 14.04 Server unable to read htaccess file, denying access to be safe Laravel 5 – Remove Public from URL Laravel 5 not finding css files How can I fix the 'Missing Cross-Origin Resource Sharing (CORS) Response Header' webfont issue? How Can I Remove “public/index.php” in the URL Generated Laravel? Apache 2.4 - Request exceeded the limit of 10 internal redirects due to probable configuration error Forbidden You don't have permission to access / on this server Htaccess: add/remove trailing slash from URL

Examples related to mod-rewrite

Getting a 500 Internal Server Error on Laravel 5+ Ubuntu 14.04 Forbidden You don't have permission to access / on this server Htaccess: add/remove trailing slash from URL Permission denied: /var/www/abc/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable? 404 Not Found The requested URL was not found on this server Redirect all to index.php using htaccess .htaccess not working on localhost with XAMPP URL rewriting with PHP No input file specified htaccess redirect to https://www

Examples related to wampserver

How to upgrade safely php version in wamp server How to enable local network users to access my WAMP sites? Project Links do not work on Wamp Server WAMP Cannot access on local network 403 Forbidden Apache won't start in wamp WampServer orange icon How can I access localhost from another computer in the same network? Forbidden: You don't have permission to access / on this server, WAMP Error Wampserver icon not going green fully, mysql services not starting up? How to change the URL from "localhost" to something else, on a local system using wampserver?