I want to have two different URLs for the same page. In particular I want to have a specific URL that shows my frontpage. The URL should be kept however. So these two URLs
www.mywebsite.com/
www.mywebsite.com/page1
should both be displaying the frontpage. I thought this could be done with WordPress's add_rewrite_rule
function, but I didn't have success with that yet.
When I do this
add_rewrite_rule('^page1', 'index.php', 'top');
It acts more like a redirect. When I try to access www.mywebsite.com/page1
I get redirected to my homepage. But I want the URL to stay the same, which this doesn't seem to do.
When I do this
add_rewrite_rule('^page1', 'index.php?pagename=$matches[1]', 'top');
it just shows the page www.mywebsite.com/page1 instead of the homepage.
I fumbled around with the rewrite rules for hours now and I'm pretty much at my wits end. Is what I want even possible?
Edit: This is different from many other questions in that I am trying to show the frontpage. The solution provided here solves this, when you can use the locations query var, but I didn't get it to work with that.