Favor ativar o javascript para poder utilizar este site.

Please enable javascript in order to use this website.

Server caching .htaccess file? Here’s how to solve it – Lucre Bem

Server caching .htaccess file? Here’s how to solve it


I had a problem with the site’s htaccess file yesterday, what happened was that the 301 redirects were not working. Inside my htaccess file I have many 301 redirects that worked just fine for a long time, but yesterday I tried to add new entries and they didn’t work. When I checked it closely, I noticed that the server doesn’t seem to be using the version that I’m saving. It looks like the server is using another file, because I’ve already cleared my browser cache, I tried another browser, I’ve cleared my website cache and I’ve even restarted the server, still the same problem. I’m using a VPS with CentOS and DirectAdmin.

This tutorial is for whoever is using this method to redirect the URLS:
Redirect 301 /category1/post /category2/post

I did that, but the server wasn’t loading the modified file. I didn’t have any caching plugin enabled, I also disabled all my site’s plugins, but still the very same problem.


Yes, mod_rewrite is working, like I said, the redirects that I created before are working, it’s just that now it seemed like the server was caching an old file. I tried to search about it and I couldn’t find a solution anywhere, I even contacted my host and they didn’t solve it.

So today I had another talk with my host and they solved it, how?

Like this:

Currently OpenLiteSpeed reads .htaccess on starting time, so if some new .htaccess files are created, or current ones modified – changes are not in effect until the reload of OpenLiteSpeed service. Please note that DirectAdmin provides customers an ability to reload OpenLiteSpeed directly from the user level, and does this automatically for the .htaccess files edited in File Manager. It’s also reloaded automatically when uploaded using FTP if pureftpd_uploadscan option is used in CustomBuild. However, if you would like to have a cronjob setup, which would reload OpenLiteSpeed every X minutes if there are newer .htaccess files that the starting time of OpenLiteSpeed, you may use a cronjob like (*/3 means every 3 minutes, you may change it to happen less/more often):

*/3 * * * * root if ! find /home/*/domains/*/*_html/ -maxdepth 2 -type f -newer /usr/local/lsws/cgid -name '.htaccess' -exec false {} +; then /usr/local/lsws/bin/lswsctrl restart; fi

Cronjob can be created as /etc/cron.d/openlitespeed_htaccess_scan. It scans for .htaccess files in public/private_html folders, with a max depth of 2 folders (it can be changed to 3, or unlimited at all, however, it could slow the scanning down).

So that’s pretty much it, just a caching problem with Litespeed.

Source: https://help.directadmin.com/item.php?id=2097

How useful was this post?

Click on a star to rate it!

Average rating 4.5 / 5. Vote count: 752

No votes so far! Be the first to rate this post.

Conheça as pessoas que tornaram este conteúdo possível

Se você gostou do conteúdo, considere fazer uma doação para os colabadores listados logo abaixo, pode ser apenas o valor de um cafezinho:

Você também poderá se interessar por:


    Leave a Reply

    XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

    Ads Blocker Image Powered by Code Help Pro


    Você está utilizando um bloqueador de anúncios. Favor adicionar o nosso site à sua lista de exceções, pois não trabalhamos de graça. Agradecemos a compreensão.

    You are using an ad blocker. Please add our site to your exceptions list, we do not work for free. We appreciate your understanding.

    DMCA.com Protection Status