httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joshua Slive" <jos...@slive.ca>
Subject Re: [users@httpd] mod rewrite redirect if NOT in URL
Date Tue, 25 Apr 2006 17:25:38 GMT
On 4/25/06, John Nichel <john@kegworks.com> wrote:

> Hi Joshua,  thanks for the response.  Unfortunately it doesn't seem to
> be working for me.  Right now I have this :
>
> RewriteEngine On
> RewriteBase /
> RewriteCond %{Request_URI} !^/redirect\.html [NC]
> RewriteRule ^/$ /redirect.html
>
> And none of the pages I go to on the site get redirected.  I set up the
> rewrite log, and nothing is being entered into there (tailing it).  To
> ensure that Apache was executing my .htaccess file, I put some bogus
> code in it and it thru an error, so that part's working.

If there is nothing in the RewriteLog, then you haven't configured it
correctly or your aren't putting your directives in the right place. 
It is always easiest to do mod_rewrite stuff in the main server or
<VirtualHost> context, and not in <Directory> sections or .htaccess
files.  This eliminates a lot of complications.

Also, as I already mentioned, something is screwy above.  RewriteRule
^/$ matches only a request for "/" and nothing else.  If you are using
it in an .htaccess file, it very likely matches nothing since the
leading slash gets stripped.  Perhaps you want RewriteRule .* instead.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message