The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Problems with .htaccess after moving from old server to new

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

  1. jgrunshaw

    jgrunshaw Registered

    Joined:
    May 7, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    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.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    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:

    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.
     
  3. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    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
     
Loading...

Share This Page