Quote:Original post by Sander
Also, on windows servers it's usually htaccess (without the .)
I wouldn't've known that. Nice catch. It's also worth noting that you can change this lookup path in the configuration.
If it still doesn't work, check the error logs. Additionally, I've needed to set RewriteBase / on one of my hosts whenever I use mod_rewrite--I still haven't figured out exactly why this is required. Either it's because of different Apache versions, or some obscure configuration settings.
@Thevenin:
I wasn't exactly clear when I specified the differences in setting directives between .htaccess and httpd.conf.
As the server configuration file can't understand relative paths, it must have a full path in the search expression (a / maps to the base directory). Rules placed in .htaccess can only understand relative paths to the executing directory--i.e., you must omit this forward slash in rules therein.
Therefore, a rule in httpd.conf consisting of
RewriteRule ^/(.*)$ http://127.0.0.1/cgi-bin/Fleurin.cgi?P=News [L]
becomes the following when placed in .htaccess:
RewriteRule ^(.*)$ http://127.0.0.1/cgi-bin/Fleurin.cgi?P=News [L]
Also, in the quote where you attempted my example, you missed the last directive. You might already understand the logic taking place behind it, but I'll put it forth anyhow.
Quote:RewriteRule ^cgi-bin/Fleurin.cgi/$ /cgi-bin/Fleurin.cgi?P=Home
This is simple. It re-maps any empty request to Fleurin.cgi to go to a default page (this shouldn't be handled here).
Quote:RewriteRule ^cgi-bin/Fleurin.cgi/forum/(.+)$ /cgi-bin/Fleurin.cgi?P=Thread&T=$1 [QSA,NC]
This takes a case-insensitive (specified by the NC flag) request to .../forum/ and substitutes it to the forum thread marked by the trailing value. The QSA flag makes sure that any additional query values are left intact.
Quote:RewriteRule ^cgi-bin/Fleurin.cgi/(.*)$ /cgi-bin/Fleurin.cgi?P=$1 [QSA]
Pretty much the same as the above rule, except that it controls page presentation.
Quote:RewriteRule ^([^.]*)$ /cgi-bin/Fleurin.cgi/$1 [N,QSA,L]
You might have noticed that, until now, the previous rules were all defined with a full prefix to the script. This takes any request that hasn't passed a previous rule, and conjoins with the script path. Then, the directives are re-examined with the newly modified request (consigned by the N flag).
The double parsing takes a slight [unnoticable] performance hit, but it's much cleaner. This should (I think) be negated if the rules are placed in the server configuration file.