How to test Apache mod_rewrite
You can check the configuration files to see if it is enabled, but we want to test if it is working. That’s Easy!
- Create two files
- test1.html
- The Apache mod_rewrite is not working
- test2.html
- The Apache mod_rewrite IS working - Congratulations!
- test1.html
- Edit the .htaccess file, or create one if it does not already exist in the root of the web site directory you are testing
- Add these lines
- RewriteEngine On
- RewriteRule ^test1.html$ /test2.html [R=301]
- Add these lines
- Copy the two html files to your website
- Run http://example.com/test1.html in your browser
- Test complete
- If apache automatically produces the working text, then everything is working correctly and mod_rewrite is installed and working properly
Popularity: 1%
Leave a Reply
You must be logged in to post a comment.