iLinux85
iLinux85

Reputation: 387

find and replace .htaccess code

I want to find and remove code in all .htaccess files and directories under /home directory

RedirectMatch \.(dynamiccontent|pl|plx|perl|cgi|php|php4|php4|php6|php3|shtml)$ http://domain.com/cgi-sys/movingpage.cgi

What is the bash command to do this job ?

edit:

i tried this command

find /home*/*/public_html/ -mindepth 1 -iname "\.htaccess" -type f -exec grep -Hi "RedirectMatch*" '{}' \;

but this command find only the code , not remove it , also the code find all redirectmatch code not the specific code i mention at the first of my question

Upvotes: 0

Views: 431

Answers (1)

anubhava
anubhava

Reputation: 785621

You can probably try this sed command:

sed -i.bak '/RedirectMatch \\\.(dynamiccontent/d' .htaccess

Upvotes: 1

Related Questions