Re: RewriteMap and patterns

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

 



Hi,

First make the proper redirections:

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

Define the fallback for requests not ending in PHP but for which I hand the php handler to deal them.
  FallbackResource /index.php

Define the handler for php file requests
<FilesMatch \.php>
  SetHandler "proxy:unix:/run/php-fpm/linuxsecurity.sock|fcgi://localhost"
</Filesmatch>

Can I ask about this again? I've got this all set up with a static map, but request for /content/view/NNNNN where NNNNN is some key that is not mapped to a value results in a 400 error.

Without this rewritemap/rewriterule, the request falls through to Joomla where a redirection.php script is called that maps the key to the corresponding value in a database.

With the rewritemap/rewriterule, it appears it doesn't fall through to the redirection.php script when there is no match.

Maybe I'm missing the role of the FallbackResource here? However, it doesn't appear it takes an argument - only an environment variable, so not sure how that would apply.

Ideas greatly appreciated.

If I could add to this, another idea I had was to run the redirection.php script directly from apache rather than in Joomla as a rewriterule. Something like this:

RewriteRule ^/content/view/([0-9]+)/? /redirection/index.php?type=view&ids=$1&uri=/content/view/$1 [L,R=301]

However, it's the same rewrite pattern as the above rewriterule, so not sure how that would work.

I should also mention the reason why I need both the static map and the redirection.php script is that I can't predict every conceivable pattern that could exist in a map. I was also thinking of putting the top 5000 key/value in the map to be really quick, then let the redirection.php script process the remaining legacy 70,000 or so...




--

Profile Photo

Dave Wreski

Chief Executive Officer

Guardian Digital Logo

We Make Email Safe For Business

Guardian Digital Facebook Guardian Digital Twitter Guardian Digital Linkedin

Phone Icon

(640)-800-9446

Email Security

Web Icon

www.guardiandigital.com

Sender Fraud Protection

Email Icon

dwreski@xxxxxxxxxxxxxxxxxxx

Training & Awareness

Location Icon

103 Godwin Ave, Suite 314, Midland Park, NJ 07432


[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