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.

How to stop cPanel from creating redirect rules from .htaccess?

Discussion in 'Bind / DNS / Nameserver Issues' started by cbogdan, Nov 15, 2015.

  1. cbogdan

    cbogdan Member

    Joined:
    Jun 29, 2011
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    I switched the hosting companies and now I have all the redirects in the Cpanel account. I have 5 sites with different rules, and what I see in the redirects section in Cpanel its all the rules, from all the sites, and in the table with redirects, first column, the Domain column, showed me for each one "All".

    Its frustraiting because now one of my sites do not work anymore.

    Why you people from Cpanel make this stupid rules? Why? it was so simple taking care about redirects from htaccess manually, or adding the rule manually, separate, in cpanel if we want!

    Ok, no options to disable this stupid rule, why? where is democracy, where is freedom? we pay monthly for this shit?

    I hope someone can help me, otherwise I will quit my deal with CPanel because I need redirections from htaccess, but not the stupid joke from cpanel!
     

    Attached Files:

  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,811
    Likes Received:
    671
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    The rules you see in the "Redirects" area of cPanel coincide with the rules added to the .htaccess file within the account. cPanel will not automatically add new rules to the .htaccess file unless you add a new redirect. Could you verify the issue you encounter when attempting to remove an existing rule from the .htaccess file?

    Thank you.
     
  3. cbogdan

    cbogdan Member

    Joined:
    Jun 29, 2011
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    I said that CPanel brings this stupid rule: use automatically redirects from .htaccess file. That means I see a long table with all the rules that I have in all my htaccess file in all my server, from all my sites. Ok? And there is a problem, the Cpanel somehow doesn t accept some rules that I have there, or I don t know what he doesn t like, but he redirects my websites wrong! Ok? I dont know if is a bug, or not, I just search fast for options to disable this stupid behavior of CPanel! So?

    I wait for some help, some ideas, from community! You created this rule that redirects all my 5 websites automatically and I don t need this, I want to do it manually because it's different for each. I have access only to whm and from there, i have no option to deactivate the automatically redirect.

    Any idea?

    Server Configuration > Tweak Settings > System > Depth to recurse for .htaccess checks

    This is the stupid rule! I don t want it because it mess up my websites! I`m sure there is a bug, and I don t care! I can take care about my redirects from htaccess files, manually! Ok?

    I give you a screenshot from what I see in an user CPanel account that I created! You can see the first column? Different websites, there have the same rules! It s written there ALL! That means the rules are applied to all the websites, yes?

    Now I stay with the empty htaccess files! I will wait one week, after this I will quit my CPanel license if no one will give me an option to resolve this problem with this stupid behavior of CPanel because for my bussiness it s important to redirect this URLs, other ways I get index errors form Google with 404 missing pages!
     
    #3 cbogdan, Nov 16, 2015
    Last edited by a moderator: Nov 16, 2015
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,811
    Likes Received:
    671
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Could you provide an example of a redirect rule that fails to work as you intend it to? For instance, are the previous rules required, or is it possible to remove the existing rules to verify if they are the reason the new rule is not working as intended? What's the ideal method that would work best for you?

    Thank you.
     
  5. cbogdan

    cbogdan Member

    Joined:
    Jun 29, 2011
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Michael, please, go away and call another helper here. You put to many questions and you don t give me any solution. Every time you smile, and this is an ironic smile. Please, this is a real problem man, why you are so "not interested" to help me? I tell you, I stay without .htaccess files because cpanel redirects wrong my site. It was ok on the last hosting company, I check the htaccess files, and there is no change, its the stupid CPanel rule that somehow combine all my htaccess files in one, and ... redirects wrong at least one of my sites.

    You ask me to give you an example? You think I`m stupid to stay with an redirect error online with my business until you will see and answer to me?

    Please, go and help others! Here you just chat with me! I`m not your friend, and I don t like how you take care about my problem!

    I hope you understand me and don t send any message to me! I wait for other people to try to help me! Look at this thread title, this is my real problem

    "How to stop cPanel from creating redirect rules from .htaccess"
     
    #5 cbogdan, Nov 20, 2015
    Last edited by a moderator: Nov 20, 2015
  6. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,469
    Likes Received:
    196
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    No. That is to say unless all sites are in the same directory as the htaccess.


    If you manually add your own special rules to your htaccess, cPanel doesn't touch them. cPanel doesn't add to them nor change anything about the stuff you added to the htaccess, manually, by editing the file yourself.

    You might want to speak with your Hosting Provider about this, or open a ticket directly to cPanel Technical Support for faster resolution to your issue.

    Looking at that attachment you added, it looks like you've got a lot going on in that htaccess.
     
  7. cbogdan

    cbogdan Member

    Joined:
    Jun 29, 2011
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Thank you for your words.

    First, in that table from screenshot are all the rules from all the htaccess files from all the domains that I have added on my CPanel Account, created from my root/whm account. I have domains separated in folders, like a normal structure, public_html > domain, for each one! So, CPanel, put all the htaccess rules in the same table, and redirect wrong one of my sites.

    Second, I talk with hosting provider, and they don t understand where is the problem, and told me to talk here, because they think is an CPanel error or bug, because I have some special rules in one of my htaccess files, and CPanel seems to get stuck on that rules.

    Now, I paste here the code from that htaccess file (I keep it in htaccess.old so I can`t provide an real error example like Michael asked for it). What is wrong at this rule?

    Code:
    <IfModule deflate_module>
        <IfModule filter_module>
            AddOutputFilterByType DEFLATE text/plain text/html
            AddOutputFilterByType DEFLATE text/xml application/xml application/xhtml+xml application/xml-dtd
            AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml image/svg+xml
            AddOutputFilterByType DEFLATE text/css text/javascript application/javascript application/x-javascript
            AddOutputFilterByType DEFLATE font/otf font/opentype application/font-otf application/x-font-otf
            AddOutputFilterByType DEFLATE font/ttf font/truetype application/font-ttf application/x-font-ttf
        </IfModule>
    </IfModule>
    
    <Files "xmlrpc.php">
    Order Allow,Deny
    deny from all
    </Files>
    
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^example\.com [NC]
    RewriteRule ^(.*) http://www.example.com/$1 [L,R=301]
    </IfModule>
    
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?example.com [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?google.com [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?facebook.com [NC]
    RewriteRule .(jpg|jpeg|png|gif)$ – [NC,F,L]
    </IfModule>
    
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RedirectMatch 301 ^/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)-([0-9]+).html$ http://www.example.com/$2/
    RedirectMatch 301 ^/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).html$ http://www.example.com/$2/
    RedirectMatch 301 ^/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).html$ http://www.example.com/$3/
    RedirectMatch 301 ^/([a-zA-Z0-9_-]+)/([0-9]+)-([a-zA-Z0-9_-]+)-2.html$ http://www.example.com/$3/
    RedirectMatch 301 ^/([0-9]+)-([a-zA-Z0-9_-]+)-2$ http://www.example.com/$2/
    RedirectMatch 301 ^/([0-9]+)-([a-zA-Z0-9_-]+)$ http://www.example.com/$2/
    RedirectMatch 301 ^/([0-9]+)-([a-zA-Z0-9_-]+)/feed/$ http://www.example.com/$2/feed/
    </IfModule>
    
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RedirectMatch 301 ^/sitemap.xml$ http://www.example.com/sitemap_index.xml
    RedirectMatch 301 ^/5250-top-10-salsas/(.*)$ http://www.example.com/5250-top-10-salsa-recipes/$1
    RedirectMatch 301 ^/5252-seven-salsa-recipes/(.*)$ http://www.example.com/5250-top-10-salsa-recipes/$1
    RedirectMatch 301 ^/arthritis-rhe/(.*)$ http://www.example.com/rheumatoid-arthritis-treatment/$1
    RedirectMatch 301 ^/natural-treatments/the-oldest-medical-system-in-the-world-ayurveda/(.*)$ http://www.example.com/ayurvedic-medicine-treatment/$1
    RedirectMatch 301 ^/why-vitamins-and-trace-elements-from-organic-fruit-and-vegetables-are-important-to-your-health/(.*)$ http://www.example.com/why-vitamins-are-important/$1
    RedirectMatch 301 ^/chromium-2/(.*)$ http://www.example.com/chromium-element/$1
    RedirectMatch 301 ^/why-is-it-advisable-to-drink-water-in-the-morning/(.*)$ http://www.example.com/drink-water-in-the-morning/$1
    RedirectMatch 301 ^/algae-what-are-the-uses-and-the-useful-substances/(.*)$ http://www.example.com/algae-uses-and-useful-substances/$1
    RedirectMatch 301 ^/bioregionalism-and-your-backyard/(.*)$ http://www.example.com/permaculture-bioregionalism/$1
    RedirectMatch 301 ^/20-tips-for-eating-more-fruits-and-veggies/(.*)$  http://www.example.com/tips-for-eating-more-fruits-and-veggies/$1
    RedirectMatch 301 ^/100-best-movies-of-all-time/(.*)$ http://www.example.com/best-movies-of-all-time/
    RedirectMatch 301 ^/heart-burn/(.*)$  http://www.example.com/heartburn/$1
    RedirectMatch 301 ^/arthritis-osteo/(.*)$  http://www.example.com/osteoarthritis/$1
    </IfModule>
    I had this htaccess rules on the last server, yes it was with Webuzo not with CPanel, but no error.

    And the error is ... my site, example.com is redirected on www.example.com/index/ no matter what URL I access, and the most frustrating is that I can t get access on wordpress dashboard!

    What to do? To accept this and still pay the license to CPanel? Or to ask for help here? Or to quit the deal with CPanel and come back to Webuzo?

    I simply ask for an option to take out CPanel from the business with htaccess rules. I don t want to see my htaccess rules in CPanel if I do not add them manualy there! I know, CPanel get the rules from htaccess files, and there is just a view mode, because if I try to delete one (there is this option to delete) after refresh the rule is still there, so its a bug after a bug at this new stupid CPanel behavior to display htaccess rules in CPanel account!
     
    #7 cbogdan, Nov 20, 2015
    Last edited by a moderator: Nov 21, 2015
  8. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,469
    Likes Received:
    196
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    So, out of all these redirects, you've got one that's an issue.

    We should narrow the issue down to that one rule then whatever it is.

    Which one specifically is giving you an issue though?

    I have modified your post to remove all real domain references to protect your privacy, there should never be a need for real domain names to be posted here. I did open your site and clicked around to many of the links and saw no issue from this end. Opening your example.com takes me to example.com as expected, and does not send me to /index/ as you mention. I am also able to get to your wordpress admin login page without being redirected anywhere else.

    That's up to you to decide of course, but why the rush to judgement here?

    You've moved your site from some other control panel to "The Hosting Platform of Choice", cPanel! I would think there might be a few bumps in the road to get things working properly on your new cPanel account. A little patience and some understanding goes a long way in getting this sort of thing resolved.

    So at the end of the day here, it sounds to me like you'll need to update the rules in your htaccess. That's not any reason to jump ship and move back to some other control panel that doesn't work the same. Nor is it a reason for the comments in your earlier post to cPanelMichael. He's the most helpful person on the forums these days and simply asked for an example of the rule thats giving you an issue.

    Your old control panel must not have been as strict or at least, worked differently, with how htaccess worked on your old account to insure the rules worked properly, than cPanel does. You shouldn't expect all the things to work perfectly out of the box here though, you moved from some other control panel that does things differently.

    You might need to start from scratch here with an empty htaccess, and add your rules back one by one until you find the one that's not working as expected, and then figure out what the issue is with the one that doesn't work. And I bet, cPanelMichael and many others on these forums can help. But, you've got to have a bit of patience, and do some troubleshooting, to get there. Your comments about leaving cPanel because something, one rule? not working serves no purpose in your quest to get this issue resolved.

    If you'd prefer to have cPanel Technical Support take a closer look at your account for an issue or bug as you suggest, you are able to open a ticket directly to cPanel Technical Support at any time.
     
    #8 Infopro, Nov 21, 2015
    Last edited: Nov 21, 2015
  9. cbogdan

    cbogdan Member

    Joined:
    Jun 29, 2011
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    So, to finish this subject, I decided to quit from CPanel, because you guys make jokes with me. I really have a problem with redirections and you dont care. I found another page that is redirected wrong, but not because my code is wrong, and because CPanel understand wrong and put all the rules from all my htaccess files, together, in the same table, all the rules being applied on all the websites. I repeat this issue at the begining, and now at the end again. So, let me give some food for the brain you strange helpers:

    On the main domain: example.com I have in the htaccess file, this rule:

    Code:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RedirectMatch 301 ^/contact/(.*)$  http://blog.example.com/contact/$1
    </IfModule>
    This page I want to be redirected on the contact page, from the subdomain blog.example.com. Instead, I get a redirect loop there guess why? Let s think, if this rule, its applied also on the subdomain blog.example.com like on the main domain, the contact page will be redirected at infinit!

    So, I`m stupid and I don t know to code my htaccess file! You are the best on the web, and you know better that CPanel has no bug because it doesnt make anything on htaccess rules, it just shows you in the table what you have in the htaccess file.

    You can not imagine how much I hate you guy because don t take me serious! I have many 301 RedirectMatch rules in my htaccess files, who knows what pages don t work in this moment!?

    And now take a screenshot with the table, do not say that I see ghosts!
     

    Attached Files:

  10. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,469
    Likes Received:
    196
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    While this may be accepted via the interface in your cPanel:
    /contact/(.*)

    It is obviously incorrect, that wild card shouldn't be needed there as you have it. You wouldn't have a url like domain.com/contact/(.*) which this creates.

    Recreating that redirect from within your cPanel might look like this:

    addrdrctswld.png

    And this, in the httaccess:
    Code:
    RewriteCond %{HTTP_HOST} ^.*$
    RewriteRule ^contact\/?(.*)$ "http\:\/\/blog\.example\.com\/contact\/$1" [R=301,L]
    This is what I meant by needing to update your rules to work properly. No one is making jokes on you, I wouldn't permit that.

    You've got lots of duplicate information in the htaccess you posted the other day that should be cleaned up and consolidated. This isn't a cPanel issue though, it's an issue with your htaccess that you've apparently created over time by adding things to it, manually. Some work, some do not. Those that don't, will need to be edited.

    We can't edit it for you, nor suggest whats wrong with your old htaccess. You'll need to do the work figuring out which ones are broke so you can fix them. I would only suggest you clear that entire htaccess and add them back in one by one though.

    You might find these docs of some use:
    URL Rewriting Guide - Apache HTTP Server
     
  11. cbogdan

    cbogdan Member

    Joined:
    Jun 29, 2011
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    I know that my htaccess is not so clean, but this advice is not a solution! Be honest man! For me, to use RedirectMatch instead of
    RewriteRule is simple and faster! And just because CPanel doesn t manage my htaccess files good, you try to point me outside the real problem.

    I will clean my htaccess but I will quit the business with CPanel because when it gets an error from a rule form a htaccess file, it apply this broken rule to all the domains on the server. Why? And you say I have to repair the rule and then will be ok. Why? You dont wanna see where I point, you don t want to accept that there is an CPanel issue some where... If you give me access to the main CPanel developer area, I will show you where you guys code wrong the CPanel! But this is your job to check, not mine (I know that your job is to talk here, but maybe some other eyes read this).

    Like I say, there is no option to stop CPanel to manage htaccess rules. If I want it, I will switch on the option, but not to be ON by default!

    If there was an option like this, I switch off this stupid setting, and then I have an 100% functional website! Not like you say to change the style of the code!
     
  12. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,469
    Likes Received:
    196
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Please do feel free to open a ticket directly to cPanel Technical Support about this.
     
  13. cbogdan

    cbogdan Member

    Joined:
    Jun 29, 2011
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    I decided to drop off the CPanel. I've already given up! If you wish, you can open a ticket, because I was convinced of the quality of CPanel services ... more money for wrong thinking! No thx!
     
  14. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,469
    Likes Received:
    196
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    The issue is the quality of your htaccess to be clear here, as you've already stated yourself:
    Sorry we weren't able to help you more.
     
Loading...

Share This Page