RewriteMap and patterns

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

 



Hi,

I'm trying to use RewriteMap on a few thousand older articles to map them to their modern equivalent. The pattern matches, but then the redirect doesn't occur. The examples and apache docs say I should be using [PT] to pass-through, but it results in a 404:

[Thu Mar 07 09:56:47.696040 2024] [rewrite:trace5] [pid 95091:tid 95121] mod_rewrite.c(493): [client 68.195.111.33:0] 68.195.111.33 - - [linuxsecurity.com/sid#5590c7db70c8]
[rid#7f02f4016480/initial] map lookup OK: map=lsv2ids[txt] key=161567 -> val=/news/hackscracks/historic-hacker-attack-on-ebay-happened-3-months-ago

[Thu Mar 07 09:56:47.696125 2024] [rewrite:trace2] [pid 95091:tid 95121] mod_rewrite.c(493): [client 68.195.111.33:0] 68.195.111.33 - - [linuxsecurity.com/sid#5590c7db70c8]
[rid#7f02f4016480/initial] rewrite '/content/view/161567' -> '/news/hackscracks/historic-hacker-attack-on-ebay-happened-3-months-ago'

I have the following in the main VirtualHost section of my apache config for this domain:

  RewriteMap lsv2ids "txt:/etc/httpd/conf.d/linuxsecurity-lsv2ids.map"
  RewriteRule "/content/view/(.*)" "${lsv2ids:$1}" [PT]

My map file simply contains this line:

161567 /news/hackscracks/historic-hacker-attack-on-ebay-happened-3-months-ago

This is a valid URL appearing as a 404:

68.195.111.33 - - [07/Mar/2024:10:13:59 -0500] "GET /content/view/161567 HTTP/1.1" 404 2983 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36" X:"SAMEORIGIN" 1/1161742 1802/11477/2983 H:HTTP/1.1 U:/news/hackscracks/historic-hacker-attack-on-ebay-happened-3-months-ago

If I replace [PT] with [L,R=301] it successfully loads the destination link, but I'm concerned I may be creating an additional redirect. What's the proper way to do this in my case?



[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