biggie
biggie copied to clipboard
Biggie in Sub-Folder — Routing Errors
From a fresh clone of this repository - Just changing config.BASE
to /biggie/
doesn't seem to work for me. Going through different pages, and refreshing from a specific page will give me routing errors, or telling me index.html is not found on the server.
I mananged to find a solution today with a test, Sub Directory Biggie Test but wondering should it normally work straight out of the box, or is it just my computer fucking up haha.
Hello @eugjlee,
It should indeed work from a fresh clone of this repository -- thanks for pointing out the issue. What did you had to change in the code so it could work on your demo?
Thanks!
Hi @baptistebriel
These are the few steps that I made to make it working on my side.
-
Modified the last RewriteRule on .htaccess
RewriteRule . biggie-subdirectory/index.html [L]
-
Route.JS
e.preventDefault()
const target_href = config.BASE.length > 1 ? config.BASE + target.getAttribute('href') : target.getAttribute('href')
framework.go(target_href)
- Page.JS
let id = slug(req, options)
config.BASE.length > 1 ? id = id.replace(config.BASE.substring(1), '') : id
- Remove all
/
from HTML Links from folder Templates. ex :
<a href="about">About</a>
- Add the subdirectory name to the beginning of the javascript/css file in Index.html
<script src="/biggie-subdirectory/build/app.js"></script
This seemed to work fine with a MAMP server running, then I point browserSync in your gulp/serve.js file to a proxy such as proxy: "http://192.168.0.33/biggie-subdirectory/" to get it working with live reload. It seems okay so far on a live server as well.