Problems with .htaccess after moving from old server to new

jgrunshaw

Registered
May 7, 2012
1
0
51
cPanel Access Level
Root Administrator
Hey guys,
I have opened a ticket with cPanel, but so far, I dont have a difinitive answer how to do this, all I know of is the problem and I am hoping someone here can help fix it.

So, I have a new server, migrated all accounts over from the older server and updated nameservers for all accounts. They ping and tracert to the new server, yet, I got a page cannot be displayed error. So I tried everything I could think of thinking it could be an apache missconfiguration. But I had sites on a dedicated IP, which function correctly, so I knew it wasn't apache.

Here is what cPanel told me.

"The problem is with the .htaccess entire remaining for the moving page which is attempting to redirect sites to server1.velocitycentral.net:
RedirectMatch \.(dynamiccontent|pl|plx|perl|cgi|php|php4|php4|php6|php3|shtml)$ http://server1.velocitycentral.net/cgi-sys/movingpage.cgi"

So, to get this functioning, the tech commented this line out on one of my main accoutns.

So I am assuming I need to do this on ALL my accounts on this server.

My question, can this be done recurrisevely all in one swoop without going into every single .htaccess file in every single user directory?

There is no such function within cPanel, but what about some kind of shell script? (I cant write shell)

I would appreciate any help.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
Hello :)

You could utilize the "find" and "replace" commands within a script to search for lines within the .htaccess file and replace them. Here is an example of a command that is used to search .htaccess files for a specific line:

Code:
find /home*/*/public_html/ -mindepth 1 -iname "\.htaccess" -type f -exec grep -Hi "RedirectMatch*" '{}' \;
You could add a "replace" command to the "find" command above to modify those files.

Thank you.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
Of note, these redirects were created during the transfer due to selecting "Express Transfer" in WHM > Transfers > Copy multiple accounts/packages from another server area. I suggest not choosing this option for future transfers if this is not the desired behavior.

Here is online documentation on that option:

Copy Multiple Accounts/Packages from Another Server