|
Aug
31
4
| Posted by Jaimie Sirovich on Aug. 31st, 2006. 4 comments — voice your opinion. |
|
This handy set of rules for mod_rewrite automatically redirects any URL ending in "/index.php" to the same URL ending in "/." It works for the root directory as well as subdirectories. RewriteCond %{THE_REQUEST} ^GET\ /.*/index\.(php|html)\ HTTP For example, "http://www.example.com/subdirectory/index.php" would be redirected to "http://www.example.com/subdirectory/." This eliminates one of the peskier canonicalization issues with relative ease. It's a bit tricky because of the way mod_rewrite updates its variables during execution — hence the odd use of the variable {THE_REQUEST}. If anyone knows an easier way or finds a problem with it, leave a comment. | |

















