Can I force .htaccess to refresh?

折月煮酒 提交于 2019-12-29 05:44:09

问题


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?


回答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




回答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.




回答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



来源:https://stackoverflow.com/questions/9126247/can-i-force-htaccess-to-refresh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!