Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

.htaccess doesn't seem to be redirecting my file requests properly

$
0
0

I have a Svelte Node.js application (compiled with adapter-node) and WordPress installation in the /public_html folder. I've set the WordPress URL to be [domain].com/admin. My code structure looks a little bit like this:

public_html/├─ admin/│├─ all the wordpress files go here│├─ ...├─ app.js <-- entrypoint for the Svelte Node.js application├─ build/ <-- Svelte compiled all my code into this folder│├─ client/││├─ script.js││├─ style.css││├─ ...│├─ server/││├─ index.js││├─ ...├─ .htaccess├─ ...

The following is an abridged version of how my .htaccess file looks like minus all the rules automatically added by other WordPress plugins:

<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteCond %{REQUEST_FILENAME} -fRewriteRule ^/_app/(.*)$ /build/client/_app/$1 [R=301,L]RewriteCond %{REQUEST_URI} !^/admin/RewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ http://localhost:3000/$1 [P,L]</IfModule>

What I am trying to achieve with the first part of my .htaccess file is: if request is a file and has /_app/ in the path, redirect it to /build/client/_app/$1 instead.

The second part should do: ignore all ^/admin/ requests (as they are WordPress related) and all file related requests. proxy all other requests to localhost:3000/$1.

Everything works perfectly when I access [domain].com–I can see the contents of the page and the links work fine. However, none of my scripts and style files are loading. They are all still going to /_app/ instead of being redirected to /build/client/_app/$1. I'm not sure why they aren't being redirected. Can someone help me out please?


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>