branzz

Registered
Aug 15, 2023
3
1
1
United States
cPanel Access Level
Website Owner
at my root is index.html with an app.js with embedded static yew wasm app (similar to React), which generates pages depending on the file path.

When I navigate to any url, it treats it like I'm trying to access a folder, rather than use the root directory's information. This worked in local development.

How do I just ignore trying file paths and just send it all to root?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
16,570
2,612
363
cPanel Access Level
Root Administrator
Hey there! I'll be honest, I'm not entirely sure what is happening with this situation. My only recommendation to adjust URLs would be traditional .htaccess methods. Can you get me more details on what it means when you say "it treats it like I'm trying to access a folder" ?
 

branzz

Registered
Aug 15, 2023
3
1
1
United States
cPanel Access Level
Website Owner
Hey there! I'll be honest, I'm not entirely sure what is happening with this situation. My only recommendation to adjust URLs would be traditional .htaccess methods. Can you get me more details on what it means when you say "it treats it like I'm trying to access a folder" ?
The site is online actually, so you can see directly what I mean: REDACTED (root directory redirects to /pali/). I designed it so most pages load without refreshing, but if you refresh on any page that you have navigated to, like bran.blue/that/file/path, it'll end up in 404, because cpanel is trying to look in public_html/that/file/path as if it were a directory. And indeed in the converse, accessing REDACTED treats it like you're trying to access the actual assets folder I have (it gives a 403 instead of 404)
 
Last edited by a moderator:

branzz

Registered
Aug 15, 2023
3
1
1
United States
cPanel Access Level
Website Owner
I solved it by adding this boilerplate to .htaccess

Code:
<IfModule mod_rewrite.c>

  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-l
  RewriteRule . /index.html [L]

</IfModule>
 
  • Like
Reactions: cPRex