erikringsmuth / polymer-router-demos

Demo routing with Polymer
MIT License
70 stars 14 forks source link

When uploading to my server: Clicking on links changes the URL, but typing the URL goes to 404 #3

Open PushkaCom opened 9 years ago

PushkaCom commented 9 years ago

Hi , when I download and upload the Router Demo , I can get to a page via link, but not through the URL - am I missing something?

Home http://test7.pushka.com/ Click Notes http://test7.pushka.com/notes

paste in the link and press enter http://test7.pushka.com/notes

Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, webmaster@test7.pushka.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

How would I get URLs working?
Do I need to link incoming URL requests to index.html or something?

//EDIT//

(this is talking about the router I linked to)

Ok - I found that for testing it is run on a Node.js server,

// let pushState and the router do the navigation. return index.html for all non-static-content routes. app.get('*', function(req, res) { res.sendFile(__dirname + '/index.html'); });

so all traffic goes through index.html and it serves the right files accordingly

How would this work on an apache server? still using a JS file? .htaccess rewriting?

PushkaCom commented 9 years ago

Ahg, I found something - a .htaccess solution

Options +FollowSymLinks IndexIgnore _/_ RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) index.html

found it here:

https://gist.github.com/rayfranco/3211654