I need htaccess help

I made a mistake in writing the htaccess. How can I reset it? I always get two www in front.

Hi carlshop. Welcome to the forums. :slight_smile:

You have a few options for editing your .htaccess file, but the easiest is probably to go into your website control panel (such as CPanel) and open it directly. Otherwise, you could delete it and start again, but I wouldn’t do that. You can do that via FTP. If you can’t view the .htaccess file on your local machine, you can create a file called something like htaccess.txt, add in the code you need, upload the file and then rename it to .htaccess.

Is that your question, or are you asking about the code itself?

Hi ralph.m,

Thank you for replying and I aplogize. I should have been more clear with my situation. I am able to edit and upload .htaccess in the server. What happened was, I was editing .htaccess, made some changes and the intended result was not happening. So, I reverted the original file into the server and now the site is stuck to the error from the previous changes. I even cleared the contents of .htaccess just to reset and remove the errors. I learned that I need to restart the apache server but I am unable to do it because I’m on a shared hosting. My host hasn’t been replying to me for days asking for assistance and I am still stuck here. Is there any other way to fix this?

Jeepers, are you sure? I’ve never had to do that after making changes to a .htaccess file. Perhaps try the site in another browser. I wonder if you just need to clear your browser cache? Just a suggestion …

Hi ralph.m,

The website is working now. I do not know what solution made it work again. I found out that my current host is a reseller, so, I contacted the real host and asked for a server restart. While waiting, I tried doing what you’ve suggested and immediately, the real host informed me that they just restarted the server. Then, it’s running again. So, I am not sure which solution caused it to work. Thank you, ralph.m. I will do your suggestion first instead of panicking.

Ah well, glad it’s sorted, one way or t’other. :slight_smile:



I’m a day late and a dollar short to say that you were correct: .htaccess changes activate IMMEDIATELY. Someone was blowing smoke … but your browser cache was an important aspect, too, as IE is notorious for not fetching refreshed pages from the server (using cached content instead).



301 redirects (permanent redirect) are allowed to be cached by browsers, and most of them do. Best way to test is to start with [R=302] which is not cacheable and only change it to [R=301] when you’re sure it’s working.
If you do happen to have cached a 301 redirect, clear your cache and restart the browser and it should be gone :slight_smile: