Reputation: 2197
I have a sitemap.xml in file in /public
folder and I want to make it public so that Google can read it from www.my_domain.com/sitemap.xml. How do I do that?
EDIT I have taken over the project and this kind of setup is not known to me. This is what I have now.
// Set up the router, wrapping all Routes in the App component
import App from 'containers/App';
import createRoutes, { createIndexRoute } from './routes';
const rootRoute = {
path: '/(en)(pl)(de)(bg)(cz)(ee)(gr)(hr)(hu)(it)(lt)(lv)(ro)(si)(sk)',
component: App,
childRoutes: createRoutes(store),
indexRoute: createIndexRoute(store),
};
const render = (translatedMessages) => {
ReactDOM.render(
<Provider store={store}>
<LanguageProvider messages={translatedMessages}>
<Router
history={history}
routes={rootRoute}
render={applyRouterMiddleware(
useScroll(
(prevRouterProps, { location }) =>
prevRouterProps && location.pathname !== prevRouterProps.location.pathname
)
)}
/>
</LanguageProvider>
</Provider>,
document.getElementById('app')
);
};
Each route looks like this
###routes.js
export default function createRoutes(store) {
// Create reusable async injectors using getAsyncInjectors factory
const { injectReducer, injectSagas } = getAsyncInjectors(store);
return [
{
path: '/home',
name: 'home',
getComponent(nextState, cb) {
const importModules = Promise.all([
System.import('containers/HomePage/reducer'),
System.import('containers/HomePage/sagas'),
System.import('containers/HomePage'),
]);
const renderRoute = loadModule(cb);
importModules.then(([reducer, sagas, component]) => {
injectReducer('home', reducer.default);
injectSagas(sagas.default);
renderRoute(component);
});
importModules.catch(errorLoading);
},
}
]
}
I just want a single route to /sitemap.xml
Upvotes: 3
Views: 1506
Reputation: 2906
I resolved by adding xml to my server rewrite rule.
It was </^((?!\.(css|gif|ico|jpg|js|png|txt|svg|woff|ttf)$).)*$/>
Updated to </^((?!\.(css|gif|ico|jpg|js|png|txt|svg|woff|xml|ttf)$).)*$/>
When I visited the /sitemap.xml I could now see the sitemap where before it was showing the page not found route.
Upvotes: 3