Beginner's mod_write on windows
The documentation of mod_write is exhaustive. For a beginner however, it is still talking about core use of the module, but not step by step manual. I made mod_write to work and here is a detailed step by step manual.
Preliminary:
1. You have Apache2 installed.
2. Put a test.html under C:\Program Files\Apache Group\Apache2\htdocs\test, start apache, then type http://localhost:8080/test/test.html, it shows the webpage.
Background:
Apache claims that modules are designed for the ease of web developers. They can be appended and removed by simply modifying config file, etc. As a beginner, don't have this in mind. With time passing by you will realize this by heart, but trying to understand this at first will only confuse you.
OK, here comes the very simple use of mod_rewrite, which the apache server apply for redirecting urls.
Step 1. Check if mod_rewrite is enabled.
Under C:\Program Files\Apache Group\Apache2\conf, there is a httpd.conf file. Search for mod_write in it, and you will probably find it commented with #. Uncomment it.
Step 2. Make two html files for testing.
I suggest test under \Apache2\htdocs\test. So, make a.html and b.html under it, with different content. Start apache, you should be able to load them using http://localhost:8080/test/a.html
Step 3. Make a .htaccess file.
This is a typical UNIX file for access control. Mod_rewrite only talks to it, so we have to make one for Windows. Under \Apache2\htdocs\test where we want to redirect webpages, make a file called .htaccess. If you have trouble save it, do it this way: open a notepad, choose "All files" when saving, then you should be able to name it .htaccess.
Step 4. Acknowledge .htaccess to Apache on windows.
Open Apache2\conf\httpd.conf, find "AllowOverride None". Change them to "AllowOverride All". Save, restart Apache
Step 5. Edit .htaccess file
Add two lines:
RewriteEngine on
RewriteRule ^a.html$ b.html
Now you are good to test. try http://localhost:8080/test/a.html, it should show b webpage.
The documentation of mod_write is exhaustive. For a beginner however, it is still talking about core use of the module, but not step by step manual. I made mod_write to work and here is a detailed step by step manual.
Preliminary:
1. You have Apache2 installed.
2. Put a test.html under C:\Program Files\Apache Group\Apache2\htdocs\test, start apache, then type http://localhost:8080/test/test.html, it shows the webpage.
Background:
Apache claims that modules are designed for the ease of web developers. They can be appended and removed by simply modifying config file, etc. As a beginner, don't have this in mind. With time passing by you will realize this by heart, but trying to understand this at first will only confuse you.
OK, here comes the very simple use of mod_rewrite, which the apache server apply for redirecting urls.
Step 1. Check if mod_rewrite is enabled.
Under C:\Program Files\Apache Group\Apache2\conf, there is a httpd.conf file. Search for mod_write in it, and you will probably find it commented with #. Uncomment it.
Step 2. Make two html files for testing.
I suggest test under \Apache2\htdocs\test. So, make a.html and b.html under it, with different content. Start apache, you should be able to load them using http://localhost:8080/test/a.html
Step 3. Make a .htaccess file.
This is a typical UNIX file for access control. Mod_rewrite only talks to it, so we have to make one for Windows. Under \Apache2\htdocs\test where we want to redirect webpages, make a file called .htaccess. If you have trouble save it, do it this way: open a notepad, choose "All files" when saving, then you should be able to name it .htaccess.
Step 4. Acknowledge .htaccess to Apache on windows.
Open Apache2\conf\httpd.conf, find "AllowOverride None". Change them to "AllowOverride All". Save, restart Apache
Step 5. Edit .htaccess file
Add two lines:
RewriteEngine on
RewriteRule ^a.html$ b.html
Now you are good to test. try http://localhost:8080/test/a.html, it should show b webpage.

0 Comments:
Post a Comment
<< Home