Accidentally Deleted .htaccess file - Is there any way i can restore it ?

Hi,

Please help , i accidentally deleted my .htaccess file and now pages have started showing 404 not found error. Is there in any way i can restore it?

Please help.

Maybe, but that all depends on the software you’re using. Maybe you can download a fresh copy of the software you’re using, get the .htaccess file from it and upload it to your website. Maybe you can access an administrative interface on the software to regenerate the .htaccess file. Maybe there is a way to disable pretty URLs so you can at least access the website while you fix this.

It all depends on the website software you’re using.

Its wordpress

And my website is https://www.palbrosinfotainment.ml

Right now my homepage is opening but when i am clicking on my post page it is page not found 404

Are you using pretty links? @Palbros

If yes, go to your WordPress Dashboard and try to disable your Pretty Links or whatever you are using.

Up Next… Goto Settings>Permalinks> and just hit “Save Changes”. It will generate you with a new .htaccess file.

If you can’t access your Dashboard, you have to delete your pretty links from your phpadmin. I’ll try to browse some articles I’ve read before. Actually, I experienced that issue before, that’s why I am able to share some insights

See screenshot: https://i.gyazo.com/da0ff103e8457b2e96682912433f4b7f.png

@Palbros said:
Hi,

Please help , i accidentally deleted my .htaccess file and now pages have started showing 404 not found error. Is there in any way i can restore it?

Please help.

Hi,
Your website is pretty much working fine at my end, I am not having any problems while visiting it.

I think you can create it again by using any editor (notepad), set the name to exactly ‘.htaccess’ then upload it to your site.

The default htaccess of wordpress is documented here: htaccess « WordPress Codex

Thanks a lot @Mauwiks, i just went to my dashboard hit save changes in permalinks and my website started working thanks

@Palbros said:
Thanks a lot @Mauwiks, i just went to my dashboard hit save changes in permalinks and my website started working thanks

No problem. If you’re wondering if you can restore the one you accidentally deleted, I do not know. I don’t think so, unless you do a recurring backup. I suggest you do it using updraftplus. It is a free plugin on WordPress. Good luck! @Palbros

@Palbros , FYI for a script as popular as WordPress, you can Google “Wordpress default htaccess”. If you have a plugin that modify’s htaccess before, try disabling and reactivating it or reinstall it again.
Hope this helps.

Always remember to backup your site and database so you’ll have smaller downtine.

Hi can you guys suggest one more thing ?

Actually whenever i am checking my website on google page speed or gtmetrix it shows some “leverage browser cache issue” . I saw some videos on youtube where people had suggested put some codes in the end of .htaccess file. I tried to do the same i copied that code and went to my control panel and clicked on edit .htaccess file in the end pasted the code(as was shown in the vdo). The moment i clicked save my .htaccess file got disappeared from my file manager.

My website is hosted on cloudflare for free ssl.

What should i do now … my website is taking a lot of time in loading.

Also right i have following plugins installed on my website ,please suggest if i need to deactivate in plugins.

  1. Swift performance lite
  2. Autoptimize
  3. W3 total cache
  4. Hummingbird
  5. Resmush.it
  6. Cloudinary
  7. Fast velocity Minifier

@Palbros said:
Hi can you guys suggest one more thing ?

Actually whenever i am checking my website on google page speed or gtmetrix it shows some “leverage browser cache issue” . I saw some videos on youtube where people had suggested put some codes in the end of .htaccess file. I tried to do the same i copied that code and went to my control panel and clicked on edit .htaccess file in the end pasted the code(as was shown in the vdo). The moment i clicked save my .htaccess file got disappeared from my file manager.

My website is hosted on cloudflare for free ssl.

What should i do now … my website is taking a lot of time in loading.

Also right i have following plugins installed on my website ,please suggest if i need to deactivate in plugins.

  1. Swift performance lite
  2. Autoptimize
  3. W3 total cache
  4. Hummingbird
  5. Resmush.it
  6. Cloudinary
  7. Fast velocity Minifier

Why are there too many?
Too many will affect the performance of your site.

I only recommend you to enable W3 Total Cache and disable the rest.

You means Swift Performance, Autoptimize, Hummingbird, fast velocity minifier all ?

what about resmush.it

But in autoptimize i have pasted my critical css which i saw on youtube is required to avoid render blocking which was the issue i saw google page speed tool was showing for my website.

infact i have created on page rule on cloudflare also which has below options activated on

  1. Rocket loader
  2. Browser Cache TTL - set for 8 days
  3. Cache Level - Cache Everything
  4. Edge Cache TTL - 7 Days
  5. Cache Deception Armor
  6. Origin Cache Control

These are the total number of plugins i have installed to boost speed and performance and to get high score on google and GTMetrix

  1. Hummingbird
  2. W3 Total Cache
  3. Swift Performance lite
  4. Resmush.it
  5. Fast Velocity Minifier
  6. Autoptimizer
  7. a3 lazy load
  8. AMP
  9. Cloudinary
  10. Glue for Yoast SEO & AMP
  11. Mobile smart for mobile users(not as good as wptouch – but wptouch’s pages get blank on phone)
  12. SVG support(vector images)
  13. WP – PageNavi

Some of your plugins have the same functions. It will conflict with each other. Please see my resources page at mauwiks.com/resources for a standard configuration you may want to consider applying on your own site or blog. Check out the Blogging Section

I recommend Swift Performance rather than W3 Total Cache. In the meantime, go ahead and check on your site’s performance after implementing my recommended solution.

Just try out the free stuff, and let me know anything else you need for assistance.