WordPress.org

Ready to get started?Download WordPress

Forums

Stop cPanel from creating redirect rules from .htaccess (2 posts)

  1. jeremyers1
    Member
    Posted 9 months ago #

    This isn't "exactly" a WordPress question, but it affects WordPress and I am hoping someone here has the solution.

    I have a domain with numerous add-on domains, and each domain has it'w own .htaccess file to help with the WordPress files and redirects.

    I recently switched hosting companies and noticed that when I did, the cPanel "Redirects" section created a bunch of rules based on its interpretation of the redirects in the .htaccess files for each and every domain. However, since cPanel read ALL of the .htaccess files for all of the add-on domains, the rules that cPanel created are applying to all the domains when they should not be. This is blocking some posts and pages in wordpress, sending some links to other domains, and creating some infinite loops. All very frustrating.

    If I deleted the redirects in cPanel, it deletes them from the .htaccess file it pulled them from. If I put it back into the .htacess file, cPanel recreates the rule.

    Does anybody know how to "divorce" these two? I still want to create custom redirects in cPanel, but I don't want cPanel to be able to read or write to the .htaccess files.

  2. AITpro
    Member
    Posted 9 months ago #

    Yep, some of the tools in cPanel seriously malfunction. The concept was a good one, but unfortunately not enough conditional checking code was added to several of the cPanel tools and disable / enable do not seem to actually really work for at least 3 or 4 cPanel tools: HotLink Protection, Redirects, IP Deny and another tool that I cannot remember the name, but has something to do with add-on domains.

    There is only one way that I have found to permanently resolve these cPanel tool problems. You need to lock your root .htaccess files with 404 or 444 Read Only file permissions. This will prevent these cPanel tools from being able to write to/wreck your .htaccess files.

    It is always better site design and site architecture to compartmentalize your security and configuration files - .htaccess files. The same applies to adding redirects for each site - you should keep your .htaccess redirects compartmentalized to each site and have that redirect .htaccess code in each site's root .htaccess files.

    I see that you are using the BulletProof Security plugin from another comment you posted in another thread so you can use BPS Custom Code to create and permanently save your .htaccess redirect code for each site.

    See this Forum post on how to create and add .htaccess redirect code and also watch the BPS Custom Code video tutorial - a link to this video tutorial is on the BPS Custom Code page.

    http://forum.ait-pro.com/forums/topic/htaccess-redirect-code-where-do-i-add-redirect-htaccess-code/

Reply

You must log in to post.

About this Topic