Re: Re: Need help understanding mod_rewrite and redirect

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

 



In a non-directory context, just anchor your target, and you can skip the RewriteBase altogether.

Redirect requires two parameters in the vhost/server context.



On Wed, May 3, 2023 at 6:57 PM Jim Weill <moondog@xxxxxxxxxxxxxxxxx> wrote:
On Wed, May 3, 2023 at 3:45 PM Frank Gingras <thumbs@xxxxxxxxxx> wrote:
1) Avoid rewriting from <Directory> or <Location> blocks.

RewriteBase says it cannot be called outside <Directory>, is that not the case...?
 
2) Avoid using mod_alias (redirect) from that context as well

I tried putting the redirect outside the <Directory> and it would not redirect at all
 
3) Provide more than one rewrite log line, context matters

There are several lines of that nature, but I think I've worked around this by putting a stanza in ssl.conf to handle it
 
4) This can be replaced with FallbackResource /index.php:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


I will look into this
 
5) Why are you using mod_rewrite, either way?

I inherited most of this many years ago.  These rules were converted from 2.2 to 2.4 a few years back and they kept working until someone decided to move the project to a new webhost outside our domain.  We run several webservers and identify the proper URL to serve based on the incoming URL, and mod_rewrite was the easiest method at the time to make sure the correct pages were served.

[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