Can I force .htaccess to refresh?

74,720

Solution 1

If you're using RewriteRule, just use R instead of R=301. For other purposes, you'll have to clear your browser cache whenever you change a redirect.

from https://stackoverflow.com/a/7749784/1066234

Solution 2

Some servers will reload as soon as you replace the .htaccess file.

If so it instantly be used for all subsequent requests. You do not need to refresh any caches.

Some servers only check htaccess periodically.

Solution 3

I had a rewriterule in my .htaccess file like,

 RewriteCond %{HTTPS} !on
 RewriteRule (.*) https://example.com%{REQUEST_URI} [L,R=301] 

and once I opened the site in localhost it never gave me a chance to hard refresh the page.

Solution: I added a random string like localhost/mywebsite/index.php?1234

Solution 4

If you already had a R=301 redirect, then you just changed where it redirects to in htaccess, but it isn't updating for you, then it's probably cached in your browser. You can't do a hard refresh on that page because it redirects. You can try in another browser and if it works there, you just need to clear cache in Chrome. Settings > Privacy > Clear browsing data. Then you only need to check "Cached images and files" This will not clear your logins or anything.

Share:
74,720
Johann Dyck
Author by

Johann Dyck

I like to design and develop web sites. I use WordPress currently. I have used ExpressionEngine in the past and am learning CraftCMS.

Updated on April 27, 2020

Comments

  • Johann Dyck
    Johann Dyck about 4 years

    We are moving a site from one CMS to another. The .htaccess file has been changed and it needs to be refreshed for the new site to work right. From what I understand the .htaccess file will only be refreshed if the browser cache is cleared? It is fine for those creating the site to clear our cache, but is there a way to get the users' browsers to get the new .htaccess file without the user clearing cache manually on his own initiative?