Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Problems with .htaccess after moving from old server to new

Discussion in 'General Discussion' started by jgrunshaw, May 7, 2012.

  1. jgrunshaw

    jgrunshaw Registered

    May 7, 2012
    Likes Received:
    Trophy Points:
    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
    RedirectMatch \.(dynamiccontent|pl|plx|perl|cgi|php|php4|php4|php6|php3|shtml)$"

    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.
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Apr 11, 2011
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    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:

    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.
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cPanelTristan

    cPanelTristan Quality Assurance Analyst Staff Member

    Oct 2, 2010
    Likes Received:
    Trophy Points:
    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
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice