Forum Moderators: phranque

Message Too Old, No Replies

Rewrite Maintenance Site

         

tomf

11:33 am on Jan 17, 2008 (gmt 0)

10+ Year Member



Hi!

I want to temporarily redirect everything to a single file (maintenance.cfm). The problem is, I want to do this for multiple subdirectories.

I have:
/de/maintenance.cfm
/en/maintenance.cfm
/es/maintenance.cfm
/it/maintenance.cfm
...

If somebody calls http://www.example.com/de/scriptname.htm it should redirect to http://www.example.com/de/maintenance.cfm. If someone else calls http://www.example.com/en/scriptname.htm it should redirect to http://www.example.com/en/maintenance.cfm.

My problem is that I have the same .htaccess file for every language version, so I can't use absolute pathes.

So what I basically want is to redirect everything to a single file in the same directory as the called file.

I allready tried something like this:
RewriteRule ^(.*)$ maintenance.cfm [R]

which always goes to the server root/maintenance.cfm

I also tried:
RewriteRule ^(.*)$ maintenance.cfm

but here the maintenance.cfm can't use any stylesheets or images anymore. Seems like it can't find them anymore?

[edited by: jdMorgan at 1:28 am (utc) on Jan. 18, 2008]
[edit reason] example.com [/edit]

gergoe

3:34 pm on Jan 17, 2008 (gmt 0)

10+ Year Member



You will need to modify the expression you use for the RewriteRule, so it not only matches anything, but with respect to the language directories. If you 'extract' the language code from the request, you can go into that directory and send back the right maintenance.cfm (using the $n backreferences).