How would it be possible to have a wildcard directory proxy?
I have gotten the basics but the issue is, it gives out the directory which I'm in, my htaccess file:
RewriteEngine on
RewriteCond %{REQUEST_URI} !(u|api|fonts|images|css|js) [NC]
# No directory
RewriteRule ^(.*)\.(jpg|gif|png|txt|mp4|mp3|json|js|zip|bmp|tiff|webp|webm|raw|psd|jpeg|jpe|wav)(.*) http://127.0.0.1:9000/owoapi/$1.$2$3?%{QUERY_STRING} [proxy]
# One Directory
RewriteRule ^([^/]+)/(.*)\.
(jpg|gif|png|txt|mp4|mp3|json|js|zip|bmp|tiff|webp|webm|raw|psd|jpeg|jpe|wav)
(.*) http://127.0.0.1:9000/owoapi/$1.$2$3?%{QUERY_STRING} [proxy]
When visiting domain.tld/image.png
, it works just fine.
When visiting domain.tld/test/image.png
, it 404's due to the fact that it includes /test/ in the proxied URL, how would I go about fixing that?
Edit: What I'm trying to achieve is to not include the preceding URL and make it act like it's being accessed via domain.tld/image.png
instead of domain.tld/test/image.png