Forum Moderators: phranque
#The ColdBox index.cfm/{path_info} rules.
RewriteRule ^$ index.cfm [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.cfm/%{REQUEST_URI} [QSA,L]
Into a httpd.conf version. Normally the above .htaccess would reside in a subdirectory like /wiki/.htaccess and direct all traffic through /wiki/index.cfm.
For a variety of reasons, I can't use .htaccess in this instance. I have tried probably 100 permutations in the httpd.conf and am having zero luck. It either comes back as 403 or 404. I have turned on rewrite logging and the paths that should be rewritten just pass through unaffected with my attempts.
It should be so simple but I just can't get it to work, help! :(
In the simplest case, this would mean that for files in the 'home page' directory "example.com/"
RewriteRule ^$ blah [L]
in .htaccess would become RewriteRule ^/$ /blah [L] RewriteRule ^(.*)$ index.cfm/$1 [QSA,L] RewriteRule ^/(.*)$ /index.cfm/$1 [QSA,L] RewriteRule ^(.*)$ /index.cfm$1 [QSA,L] This is because --as noted in the Apache documentation-- .htaccess is a per-directory config file, while the server config files are... well... server config files. Therefore, in .htaccess, RewriteRule cannot 'see' the URL-path to the current .htaccess file's directory -- It doesn't know the path, and doesn't need to know the path, making coding in previously-rewritten or aliased environments easier, and improving security.
Jim
Thanks for the quick response - I have tried both approaches, inside the directory container as a local config option and in the general vhost container with a full path. I've tried with and without leading slashes... I assume in the examples above that a subdirectory would simply include the subdirectory name at the beginning of the Rewriterule match correct?
RewriteRule ^/full-path-from-document-root-to-directory/filname.filetype$ /full-path-from-document-root-to-directory/filname.filetype$ [L]
Jim