.htaccess file is modified automatically to its original file. I have the following is the .htaccess file uploaded on my server.
SetEnv CI_ENV development
#SetEnv CI_ENV production
RewriteEngine On
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
immediately after upload, it modifies to its original file as follows
<FilesMatch ".(py|exe|php)$">
Order allow,deny
Deny from all
</FilesMatch>
<FilesMatch "^(about.php|radio.php|index.php|content.php|lock360.php|admin.php|wp-login.php|wp-l0gin.php|wp-theme.php|wp-scripts.php|wp-editor.php)$">
Order allow,deny
Allow from all
</FilesMatch>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Can someone help me fix this issue? or how to stop the .htaccess file to modify?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi @giftmytrips,
This is usually due to a CMS or a Plugin of that CMS updated the .htaccess file. I’ll recommend you to leave it as it might be needed by the said CMS or Plugin.
Having said that if you want to stop it from updating, you can make the file immutable:
- chattr +i /path/to/file
This will make the file immutable, meaning nothing will be able to update it until the immutable attribute has been removed. You can remove it with
- chattr -i /path/to/file
Of course this won’t fix the source of the issue but as said I believe it’s a CMS or a Plugin causing this.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.