Re: [users@httpd] mod rewrite redirect if NOT in URL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/25/06, John Nichel <john@xxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux