frozeman / meteor-build-client

A tool to bundle the client part of a Meteor app.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Routing

GarethWright opened this issue · comments

Once copied onto my server routing works fine if you hit the root url first, but not if you hit a root/charts

404 error.

Any way to get this working again?

Links might solve your problem, but you'll have to make them for every path that you might have.
cd charts
ln ../index.html index.html
if you do a symlink:
cd charts
ln -s ../index.html index.html
then some websevers will not follow it because they see it as a security issue.

Note that when you edit index.html in one place, they all change, but they look like separate files; they don't show as symlinks when you 'ls' the directory.

I ended up just using htaccess at rewrite urls back to index.html.

@GarethWright That's a much better way of handling it. I thought of that just a few minutes ago, but you beat me to it.

Something like this should probably be added to the docs. For Apache, this can be your .htaccess file:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # Always pass through requests for files that exist
    # Per http://stackoverflow.com/a/7090026/223225
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]

    # Send all other requests to index.html where the JavaScript router can take over
    # and render the requested route
    RewriteRule ^.*$ index.html [L]
</IfModule>

Will add.