If wanting to use Apaches Mod_Rewrite (Module MUST be loaded to the server)
in .htaccess
| Code |  |
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^index\.html$ YaBB.pl
or
| Code |  |
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^index\.html$ http://www.yourdomain/cgi-bin/yabb2/YaBB.pl
* Although highly unlikely, your host may have +FollowSymLinks enabled at the root level, yet disallow its addition in .htaccess; in which case, adding +FollowSymLinks will break your setup (probably a 500 error), so just remove it, and your rules should work fine.
Though this is the simplest example possible, it may throw a few people off. The structure of the ‘old’ URL is the only difficult part in this RewriteRule. There are three special characters in there.
* The caret, ^, signifies the start of an URL, under the current directory. This directory is whatever directory the .htaccess file is in. You’ll start almost all matches with a caret.
* The dollar sign, $, signifies the end of the string to be matched. You should add this in to stop your rules matching the first part of longer URLs.
* The period or dot before the file extension is a special character in regular expressions, and would mean something special if we didn’t escape it with the backslash, which tells Apache to treat it as a normal character.
So, this rule will make your server transparently redirect from Index.html to the YaBB.pl page. Your reader will have no idea that it happened, and it’s pretty much instantaneous.
Forcing New Requests
Sometimes you do want your readers to know a redirect has occurred, and can do this by forcing a new HTTP request for the new page. This will make the browser load up the new page as if it was the page originally requested, and the location bar will change to show the URL of the new page. All you need to do is turn on the [R] flag, the NC is non case sensitive by appending it to the rule:
| Code |  |
RewriteRule ^old\.html$ new.html [R, NC]
e.g. (.+)\.html? matches foo.htm and foo.html
(foo)?bar\.html matches bar.html and foobar.html
further info here:
Rewrite Rule Tutorial