Reputation: 81
I'm using Wordpress and the REST API to build an app. Unfortunately, I need to to access a WordPress PHP page at when the user points to /register.
When I point the browser to the /register page, it displays a universal page rendered by react. It's triggered by this:
<Route path='*' component = {Single} />
How can I make an exception to this rule and retrieve a page from the WordPress backend?
This is my router:
<Route path="/">
<IndexRoute component={Home} />
<Route path='/services' component ={Services} />
<Route path='/blog' component={Blog} />
<Route path='/submit' component = {Submit} />
<Route path='/myaccount' component = {MyAccount} />
<Route path='/register' component = {Register} />
<Route path='/logare' component = {Login} />
// <Route path='*' component = {Single} />
</Route>
Upvotes: 0
Views: 223
Reputation: 16441
Ah okay, your comment cleared things up for me. You can use the exact
prop on each <Route>
to make sure that only exact urls get matched to that component.
<Route path="/">
<IndexRoute component={Home} />
<Route path='/services' component ={Services} />
<Route path='/blog' component={Blog} />
<Route path='/submit' component = {Submit} />
<Route path='/myaccount' component = {MyAccount} />
<Route exact path='/register' component = {Register} />
<Route path='/logare' component = {Login} />
<Route path='*' component = {Single} />
</Route>
Upvotes: 1