Apache HTTP Server or IBM HTTP Server mod_rewrite Example
Having a hard time with the mod_rewrite?
This example is showing you how to simply redirect from bad.html to good.html.
1. Modify your httpd.conf as follows:
2. If you use a VirtualHost for port 443, also include the lines above within the VirtualHost tags.
3. Restart your web server.
3. Test the redirection by accessing http://yourhost.com/bad.html
More examples and extensive documentation.
This example is showing you how to simply redirect from bad.html to good.html.
1. Modify your httpd.conf as follows:
LoadModule rewrite_module modules/mod_rewrite.so
RewriteEngine on
RewriteRule ^/bad\.html$ good.html [R]
2. If you use a VirtualHost for port 443, also include the lines above within the VirtualHost tags.
<VirtualHost *:443>
...
LoadModule rewrite_module modules/mod_rewrite.so
RewriteEngine on
RewriteRule ^/bad\.html$ good.html [R]
</VirtualHost>
3. Restart your web server.
3. Test the redirection by accessing http://yourhost.com/bad.html
More examples and extensive documentation.
The VirtualHost thing is what got me! Thanks for your post, it was helpful!!
ReplyDelete