Tuesday, November 5, 2013

WampServer + Apache mod_rewrite: Simple Test



1) PREPARATION
2) ENABLE mod_rewrite
3) TEST mod_rewrite
4) ENABLING Apache mod_rewrite USING GUI MENU.
5) DOWNLOAD
6) REFERENCE

1) PREPARATION

1.1) Download and install WampServer (follow this tutorial, http://php-steps.blogspot.com/2013/11/wampserver-download-setup-installation.html )

2) ENABLE mod_rewrite

2.1) Once your WampServer is up and running, go to URL http://localhost
2.2) Scroll down to find the link to phpinfo().
Click on the link.
2.3) In the phpinfo() page, under  Configuration-apache2handler section, look for the row named Loaded Modules. It should contain the word “mod_rewrite”. You can also use the Find function (as shown below) to search for the exact matching word.
In the example below, “mod_rewrite” doesn’t exist. Go to the next step to enable the module.
2.4) Open the file {wamp home}\bin\apache\Apache2.2.11\conf\httpd.conf and search for the text “rewrite”.
It is recommended that you use Notepad++ so that you can easily find the line number, e.g. line 116
2.5) Uncomment the line (by deleting the symbol #) as follows:
2.6) Save, restart the server and check phpinfo() again as follows:
The word “mod_rewrite” should now appear in the Loaded Modules row.

3) TEST mod_rewrite

3.1) Prepare the following file/folder structure to test mod_rewrite
{wamp_home}/www/test_rewrite/
                                       .htaccess
                                       index.html
                                       page1.html
3.2) Type the contents as follows:
3.3) Browse the url http://localhost/test_rewrite:
3.4) To double-check the rewrite effect, comment the line no.116 back…
…and browse the url http://localhost/test_rewrite :
…if you delete the file .htaccess and browse the url http://localhost/test_rewrite again:

4) ENABLING Apache mod_rewrite USING GUI MENU.

4.1) Click on the WampServer icon at the tray, click Apache/Apache Modules/rewrite_module.
4.2) The WampServer will restart automatically.
4.3) Make sure that the file .htaccess is placed into test_rewrite folder.
4.4) Browse the url http://localhost/test_rewrite:

5) DOWNLOAD

6) REFERENCE

No comments:

Post a Comment

Labels