You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Matthew Smith <ch...@gmail.com> on 2013/02/26 04:10:55 UTC
[users@httpd] redirect non-existing directory request to that directory with file
name appended
Right now I have this:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /index.cfm [L]
Which works, but does not do what I want
Rather than redirecting to the root index.cfm, I would like to have it
directed to the nonexistent directory with "\index.cfm" appended. Sounds
weird, I know, but this will trigger the onMissingTemplate component in
coldfusion, rather than giving me the standard apache 404.
so /directory/item-1/ should go to /directory/item-1/index.cfm
Thank you.
Re: [users@httpd] Re: redirect non-existing directory request to
that directory with file name appended
Posted by Ben Johnson <be...@indietorrent.org>.
On 2/26/2013 2:39 PM, Matthew Smith wrote:
> Tried this but it causes a 500 error. Any ideas where I am off?
>
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteRule (.*) /site_mysite_com/$1/index.cfm [L]
>
> On Mon, Feb 25, 2013 at 10:10 PM, Matthew Smith <chedderslam@gmail.com
> <ma...@gmail.com>> wrote:
>
> Right now I have this:
>
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteRule . /index.cfm [L]
>
> Which works, but does not do what I want
>
> Rather than redirecting to the root index.cfm, I would like to have
> it directed to the nonexistent directory with "\index.cfm" appended.
> Sounds weird, I know, but this will trigger the onMissingTemplate
> component in coldfusion, rather than giving me the standard apache 404.
>
> so /directory/item-1/ should go to /directory/item-1/index.cfm
>
> Thank you.
>
>
>
>
> --
> Regards,
> chedder is bedder
>
Like this?
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.cfm?q=$1 [L,QSA]
It sounds like you are looking for the functionality that QSA (Query
String Append) provides.
-Ben
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
[users@httpd] Re: redirect non-existing directory request to that directory with
file name appended
Posted by Matthew Smith <ch...@gmail.com>.
Tried this but it causes a 500 error. Any ideas where I am off?
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /site_mysite_com/$1/index.cfm [L]
On Mon, Feb 25, 2013 at 10:10 PM, Matthew Smith <ch...@gmail.com>wrote:
> Right now I have this:
>
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteRule . /index.cfm [L]
>
> Which works, but does not do what I want
>
> Rather than redirecting to the root index.cfm, I would like to have it
> directed to the nonexistent directory with "\index.cfm" appended. Sounds
> weird, I know, but this will trigger the onMissingTemplate component in
> coldfusion, rather than giving me the standard apache 404.
>
> so /directory/item-1/ should go to /directory/item-1/index.cfm
>
> Thank you.
>
>
--
Regards,
chedder is bedder