Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a website on the server, containing .htaccess. For testing purposes I wanted to replace it with another .htaccess, but changes have been ignored. Even though I have replaced with new .htaccess or even deleted it from server root, website is still working, like I haven't done any changes.

Basically new .htaccess is being ignored, it's like server cached it and doesn't care about the new one. Because of that a testing site won't work since old rewrite rules are still in place. All I know about server is that it's Linux.

Is there any way to make server see the changes? I cannot restart server.


EDIT: As it turns out it's nginx server, therefore .htaccess isn't allowed.

share|improve this question
    
Every .htaccess file is re-read and re-parsed for every single request. Please clarify what settings are in the file, what you're expecting to see and what you're seeing instead. –  Shane Madden Jun 11 '12 at 6:13
    
I used to have redirect all files to index.php. Now I ditched that and I am rewriting files in /news. Unfortunately it's still using the old settings. If i remove .htaccess from server it still uses index.php only. No matter what I do, the first .htaccess settings are still in place –  Bojan Kogoj Jun 11 '12 at 6:19

1 Answer 1

Is AllowOverride set for the directory containing your .htaccess file in httpd.conf? If not, .htaccess will be ignored.

Normally, .htaccess files will not be used in the server root directory, which you mention.

Unfortunately, you will need to restart Apache in order to pick up changes in httpd.conf. Once that is done, you do not need to restart Apache when you change .htaccess.

share|improve this answer
    
.htaccess works, since original website wouldn't work otherwise. However changes to it (replacing it or even removing) are being ignored. It's still listening to original one. –  Bojan Kogoj Jun 11 '12 at 5:23
    
Check AllowOverride, and in particular what parts of the site it is configured for. If removing .htaccess makes no difference, then probably it was never used in the first place, but appears to work because it duplicated defaults or what is configured in httpd.conf or its included files. –  ramruma Jun 11 '12 at 7:40
    
You might also check (via apache's logs) that you are actually retrieving fresh content and not just cached pages. –  ramruma Jun 11 '12 at 7:47
    
.htaccess files are normally used on a per-directory basis. You talk of changing from / to /news. Is your new .htaccess in /news, and (once more) what is AllowOverride set to for /news? –  ramruma Jun 11 '12 at 9:02
    
.htaccess files most certainly are normally used in the server root directory. In many cases that's the only place they're used. –  John Gardeniers Jun 11 '12 at 11:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.