Re: Mod_Rewrite voodoo

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

 



On Sat, Jan 9, 2010 at 3:18 PM, Reese <howell.r@xxxxxxxxxxxxxxxx> wrote:
> On 09-Jan-10 14:29, Eric Covener wrote:
>
>>> I tried:
>>>
>>> RewriteEngine On
>>> RewriteCond %{HTTP_HOST} subdomain\.domain\.ext
>>> RewriteCond %{REQUEST_URI} ^/20\d+
>>> RewriteRule (.*)(0[5-9]).html$ /20$2/$1$2.html [R=301,L]
>>>
>>> For http://subdomain.domain.ext/fileDDMMYY.ext there was no effect,
>>> that file loaded at that URL.
>>
>> I think that condition needs negating, because you want your rule to
>> not have a chance to execute against the rewritten URL that will have
>> the leading date.
>
> Which condition needs negating? The one with HTTP_HOST? What
> then would keep this rewrite rule from breaking external links
> where they also contain a matching NN.html string?

The one you added to stop the loping, for REQUEST_URI.  You don't want
your rule to run if the URL already begins with a date, so the
condition short circuits.

>
> Or did you mean, remove the files we planned removing and then
> do testing? It's live files, so the client won't remove them
> until after the rewrite rule has been proven to work.
>
>>> If I specified http://subdomain.domain.ext/2009/fileDDMM09.ext
>>> (the file does exist and is the target of the redirect), then I
>>> received a looping error.
>>>
>>> So I tried swapping the positions of the two RewriteCond statements.
>>> That caused an internal server error.
>>
>> Should not matter.
>
> And yet, it did. No effect one way, internal server error the other.
> It's Apache v2.2.8 running on CentOS v4. something, 4.6 I think.
>

Would have to see your corresponding errorlog entry, and the htaccess
file at the time the error was generated, but I don't think swapping
two conditions is likely to trigger an ISE.

-- 
Eric Covener
covener@xxxxxxxxx

---------------------------------------------------------------------
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