.
How To Enable Mod Rewrite
This tutorial demonstrate how to enable Apache mod rewrite using UwAmp server.
|
1) Download and Run UwAmp server.
UwAmp server is just to help us find the Apache Module Settings quickly. It is really useful for beginners who are struggling to understand so many aspects of a web server.
Download the application from http://www.uwamp.com/en/?page=download or from here.
When you run, you should get a user interface as follows. You should notice the Apache Config button. Click on the button.
2) Apache Config Window
Apache Config window consists of two tabs; Virtual Server and Modules.
Select Modules tab.
You should be able to see the item rewrite_module.
Select the item.
Close the window.
UwAp will automatically restart the server.
3) Write .htaccess specification
We are going to write an instruction into .htaccess so that all urls are rewritten back into the url containing that .htaccess file.
This is useful particularly when we want to create a RESTFUL website.
|
file: .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
|
file: index.php
<?php
echo 'hello world';
?>
|
OUTCOME.
4) Test
Get back to UwAmp window and disable the module.
You get the error message…
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at contact@exemple.com to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Apache/2.4.10 (Win32) OpenSSL/1.0.1h PHP/5.4.31 Server at localhost Port 80
|
Your Apache Error Log reports a missing module.
No comments:
Post a Comment