Reputation: 40539
Have installed WordPress on a server which previously had an index.html file containing:
<meta http-equiv="refresh" content="0; url=home.html">
Now even though the index.html file no longer exists, my browser (and presumably the browsers for many users that have previously viewed the site) is still redirecting to home.html. The result of this is that WordPress gives a "Nothing Found" error when trying to view the website root (ie mysite.com redirects to mysite.com/home.html").
I've tried adding an Apache setting to the .htaccess file (as per this) but it didn't work. Possibly the Apache module is disabled. Not sure how to check. It's a cPanel site, and I may not be able to activate the module if it's not installed.
I also tried creating a home.html file that redirects to home.php, and the home.php contains:
<?php require_once("index.php");
However though the redirect worked, I still got a "Nothing found" error from WordPress. This may be due to the WordPress .htaccess settings (I could edit that if it would fix the problem).
Obviously clearing my browser cache will fix it for me, but I want a fix to implement on the site that will work for other users. Can anyone suggest something?
Upvotes: 4
Views: 539
Reputation: 5890
The browser's cache is mostly out of your hands, but you can use a query string to force the browser to make another request.
For instance home.html
could have
<script> document.location = '/index.html?noonce=1'; </script>
As suggested by @IMSop the Apache mod_rewite
would be cleaner.
RewriteRule ^/home.html /index.php?nonce
Then you could use a canonical in your index.html
so search engines know the correct url.
<link rel="canonical" href="https://example.com/" />
google's page on canonical links
Upvotes: 2