Forum Moderators: phranque
Here's my code:
RewriteCond %{REMOTE_ADDR} ^11\.1\.1\.1$ [OR]
RewriteCond %{REMOTE_ADDR} ^11\.11\.11\.1[6-9]$ [OR]
RewriteCond %{REMOTE_ADDR} ^11\.11\.11\.2[0-3]$ [OR]
RewriteCond %{REMOTE_ADDR} ^111\.111\.11\.1[0-7]$
RewriteCond %{REQUEST_URI} ^/Stayout/
RewriteRule (.*) /ViewThis/$1
When I put this in my .httaccess file I get a 500 error. Anyideas on what I'm doing wrong? (Yes there is no [L] on this rule as all requests are redirected through a CGI in latter rules)
Welcome to WebmasterWorld!
I don't see anything wrong with that code snippet -- I assume that you have other, already-working rules?
Is there anything useful in your raw server error log when you get the 500 Error?
Perhaps you may have set up an 'infinite' loop, though -- it depends on where this code resides and the relationship between the paths of the other files. You could try adding a loop-killer by excluding the /ViewThis/ path:
RewriteCond %{REMOTE_ADDR} ^11\.1\.1\.1$ [OR]
RewriteCond %{REMOTE_ADDR} ^11\.11\.11\.1[6-9]$ [OR]
RewriteCond %{REMOTE_ADDR} ^11\.11\.11\.2[0-3]$ [OR]
RewriteCond %{REMOTE_ADDR} ^111\.111\.11\.1[0-7]$
RewriteCond %{REQUEST_URI} ^/Stayout/
RewriteCond %{REQUEST_URI} !^/ViewThis/
RewriteRule (.*) /ViewThis/$1
Jim
Apache modules are executed in the reverse order of their appearance in the LoadModule list. For example, if your cgi is a PERL script, and if the PERL module appears in the LoadModule list *after* mod_rewrite, then your CGI script will run before mod_rewrite ever gets a chance to execute.
This applies only to Apache 1.x, though; Apache 2.x uses a different priority-resolution method to determine module execution order.
Jim
Looks like I'm on Apache 1.3
Unfortunalty here's where my novice really shows...What/Where is the LoadModule list. Im useing a hosted site so I'm betting I cant get to it.
You'll need to contact your host to resolve this. Refer them specifically to the discussion of LoadModule order versus module execution order in the Apache documentation. This is described specifically in the description of the AddModule directive [httpd.apache.org]; Modules are executed in the reverse order that they are loaded, and unfortunately, many hosts don't realize that and place script interpreter module load directives *after* mod_rewrite. If the script interpreter runs first, then no URL that runs a script can be rewritten.
This may not be the cause of your problem, but it is a likely suspect.
Jim