This is a little trick I've used a few times to emulate Folders on a site and drop the extensions. In this example I'm using a PHP site but could easily be ported for other file types. One caveat to look out for is files will not always want to be called anymore from their .php and linking to new pages should be done with a href="/newpage" instead of just href="newpage".
Play with it, it's just a down and dirty method to make your urls more sef for sites not running on a cms that has this built into it.
- RewriteEngine On
- RewriteBase /
- RewriteRule ^admin/.*$ - [PT]
- # Use the above line for a folder that you DON'T want to follow these rules
- RewriteRule ^/?([a-zA-Z0-9-_/]+)/$ $1.php [L]
- # Here's where the "magic" happens
- # http://www.example.com/page.php - OLD
- # http://www.example.com/page/ - NEW
CommentsSubscribe to comments
You need to login to post a comment.