You need to add a .htaccess file where index.html is.
Here is a full working code for routing and iron-pages in it.
.htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /
index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
<title>....</title>
<meta name="description" content="....">
<link rel="manifest" href="/manifest.json">
<link rel="import" href="/src/main-app.html" async>
<style>
.....
</style>
</head>
<body>
<main-app></main-app>
<script>
window.performance && performance.mark && performance.mark('index.html');
Polymer = {lazyRegister: true, dom: 'shadow'};
(function() {
if ('registerElement' in document
&& 'import' in document.createElement('link')
&& 'content' in document.createElement('template')) {
// platform is good!
} else {
// polyfill the platform!
var e = document.createElement('script');
e.src = '/bower_components/webcomponentsjs/webcomponents.min.js';
document.body.appendChild(e);
}
})();
</script>
</body>
</html>
main-app.html
<!-- START OF IMPORTS -->
<link rel="import" href="../bower_components/polymer/polymer.html">
<!-- Iron Ajax -->
<link rel="import" href="../bower_components/iron-ajax/iron-ajax.html">
<!-- Route -->
<link rel="import" href="../bower_components/app-route/app-location.html">
<link rel="import" href="../bower_components/app-route/app-route.html">
<!-- Iron Pages-->
<link rel="import" href="../bower_components/iron-pages/iron-pages.html">
<!-- Fragments -->
<link rel="import" href="you-page-to-go-to.html">
<dom-module id="main-app">
<template>
<style>
....
</style>
<!-- App Routing -->
<app-location route="{{route}}"></app-location>
<app-route
route="{{route}}"
pattern="/:page"
data="{{routeData}}"
tail="{{subroute}}">
</app-route>
<iron-pages role="main" selected="[[page]]" attr-for-selected="name" selected-attribute="visible">
<!-- General -->
<you-page-to-go-to name="you-page-to-go-to"></you-page-to-go-to>
</iron-pages>
</template>
<script>
Polymer({
is: 'main-app'
properties: {
page: {
type: String,
reflectToAttribute: true,
observer: '_pageChanged'
},
title:{
type:String,
value:"null"
}
},
/* For route */
observers: [
'_routePageChanged(routeData.page)'
],
_routePageChanged: function(page) {
this.page = page || 'home';
this.drawerOpened = false;
},
_pageChanged: function(page, oldPage) {
if (page != null) {
this.title = page;
this.importHref(
this.resolveUrl('main-' + page + '.html'),
function() {
this._pageLoaded(Boolean(oldPage));
}, null, true);
}
},
_pageLoaded: function(shouldResetLayout) {
if (shouldResetLayout) {
this.async(function() {
}, 1);
}
},
});
</script>
</dom-module>