|
Joined: Apr 2002
Posts: 1,768
Addict
|
Addict
Joined: Apr 2002
Posts: 1,768 |
My objective is to write an .htaccess file that redirects all requests to a particular file. This .htaccess file will reside in the top level web root directory. I've tried this: RediectMatch .* http://example.com/maint_notice.php The problem is that it results in a request-loop, with the .php file never getting accessed. I'd like to change the RedirectMatch so that it redirects all requests except for requests for that file. But I don't know how to write a match pattern that accomplishes this. If there were a "RedirectNotMatch" directive, that would solve the problem. Any ideas?
|
|
|
|
Joined: Feb 2002
Posts: 2,286
Veteran
|
Veteran
Joined: Feb 2002
Posts: 2,286 |
Would it work if you had an DirectoryIndex maint_notice.php above the command, and then did a RedirectMatch ^/$ http://www.example.com beneath - or would you still hve a loop? It would work with directing it to a sub-domain, but that may not be an option here.
Fans Focus - Focusing on Fans of Sport (Okay - mainly football (the British variety at the moment - but expanding all the time....)
|
|
|
|
Joined: Apr 2002
Posts: 1,768
Addict
|
Addict
Joined: Apr 2002
Posts: 1,768 |
Thanks, but that doesn't seem to have any effect. By redirecting to a subdomain, do you mean: RedirectMatch .* http://sub.example.com/maint_notice.phpMy hosting account allows creation of subdomains. I think they're implemented as subdirectories under the main directory, so the .htaccess file in the main directory might still get processed, but I can try that.
|
|
|
|
Joined: Apr 2002
Posts: 1,768
Addict
|
Addict
Joined: Apr 2002
Posts: 1,768 |
I tried that subdomain approach, but it failed for the above reason.
|
|
|
|
Joined: Feb 2002
Posts: 2,286
Veteran
|
Veteran
Joined: Feb 2002
Posts: 2,286 |
Did you get this one cracked Dave?
Fans Focus - Focusing on Fans of Sport (Okay - mainly football (the British variety at the moment - but expanding all the time....)
|
|
|
|
Joined: Apr 2002
Posts: 1,768
Addict
|
Addict
Joined: Apr 2002
Posts: 1,768 |
Maybe. I'm trying this: RewriteEngine On <br />RewriteRule maint_notice\.php$ - [L] <br />RewriteRule .* http://example.com/maint_notice.php The first rule catches requests for maint_notice.php, leaves them alone (replacement string = "-") and then stops processing rules (flag = "L"). The second rule catches anything else. It seems to work, but I haven't fully tested it yet. Another possibility was suggested in response to a post I made elsewhere, but I haven't tried it yet: RewriteEngine On <br />RewriteBase / <br />RewriteRule !^maint_notice\.php$ maint_notice.php [R] ----- Edit: Both of the above methods work. I decided to use the second one, since it seems a little simpler.
Last edited by Dave_L; 06/14/2003 11:03 AM.
|
|
|
|
Joined: Feb 2002
Posts: 2,286
Veteran
|
Veteran
Joined: Feb 2002
Posts: 2,286 |
I take it that it didn't work, as the code has gone 
Fans Focus - Focusing on Fans of Sport (Okay - mainly football (the British variety at the moment - but expanding all the time....)
|
|
|
|
Joined: Apr 2002
Posts: 1,768
Addict
|
Addict
Joined: Apr 2002
Posts: 1,768 |
It worked, but 6.3 has a bug that strips the [ code ] tag. The bug has been fixed here, so I'll repost the code. P.S. I posted the fix for the code tag in the Infopop threads bugs forum.
Last edited by Dave_L; 06/14/2003 11:20 AM.
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 1,157
Joined: July 2001
|
|
Forums63
Topics37,575
Posts293,931
Members13,823
|
Most Online6,139 Sep 21st, 2024
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|