Hi 2gether I have a file on my webserver, like: www.domain.com/demo/demo.iso Now I'd like to go every request for this link just to www.domain.com/demo/index.html or just www.domain.com/demo How can I do this with rewrite? I don't get it RewriteEngine On RewriteCond ? RewriteRule ? Thanks so much! P@sco
works perfectly - thanks! Just for my understanding: I could have done that with mod_rewrite too? Cheers, p@sco
yeah you could have, something like this: RewriteEngine on RewriteRule ^demo\demo.iso$ demo.html 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 demo\demo.iso to the demo.html page. Your reader will have no idea that it happened, and it’s pretty much instantaneous. NOTE: RewriteEngine on (only needs to be specified once in your .htaccess file).