The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. Intermediate & Advanced SEO
    4. CPanel Redirect not allowing login access.

    CPanel Redirect not allowing login access.

    Intermediate & Advanced SEO
    9 2 1.1k
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Highline_Ideas
      Highline_Ideas last edited by

      Using the redirect function in cPanel I am able to create the 301 redirect that I need to not have duplicate content issues in Moz. However, the issue now is that when I try to login to domain.com/login it redirects to domain.com/index.php?q=admin, which is not a page on the site and I can no longer login.

      I have checked the htaccess file and it appears that the entry is correct ( I originally thought that the cPanel redirect was not writing access correctly ). I am not sure if there is a small detail that I am missing with this or not.

      So my main question is how do I redirect my site to remove dup content errors while retaining the login at domain.com/admin and not be redirected to domain.com/index.php?q=admin? Thank you ahead of time for your assistance.

      1 Reply Last reply Reply Quote 0
      • LynnPatchett
        LynnPatchett last edited by

        Hi Andrea,

        I am not sure exactly what dup content issues you are trying to correct...

        If you have ftp access then you can simply take out the last lines that were added through cpanel and that should then let you login again. As for the correct setup, give us a few more details on what exactly you are trying to achieve.

        Highline_Ideas 1 Reply Last reply Reply Quote 0
        • Highline_Ideas
          Highline_Ideas @LynnPatchett last edited by

          Lynn,

          Sorry for the vagueness of the question. The issues I am getting in my Moz report is duplicate content issues resulting from the indexing of both the www. and non-www. sites. I have set my preferred url in WT to be the non-www. and so I want to 301 redirect the www to non-www so I am done in one step, but it appears that in doing this in C-panel causes an issue with the login by appending the /index.html at the end of the login url creating a 404 error. I know I can remove the code to login again from the htaccess file but in removing the redirect I get duplicate content errors again. I was hoping to avoid redirecting every individual page. But is that the solution? Thanks again for the info.

          LynnPatchett 1 Reply Last reply Reply Quote 0
          • LynnPatchett
            LynnPatchett @Highline_Ideas last edited by

            Hi Andrea,

            What code are you using to to the redirects? If you can edit the htaccess file directly then simply drop  the following code into it and all calls to a www url should be redirected to the non www url. No index.html or anything else should be added if you use this, it simply redirects all www to non www urls.

            RewriteEngine On
            RewriteCond %{HTTP_HOST} ^www.yourdomain.com$ [NC]
            RewriteRule ^(.*)$ http://yourdomain.com/$1 [R=301,L]

            Is that what you are after?

            Highline_Ideas 1 Reply Last reply Reply Quote 0
            • Highline_Ideas
              Highline_Ideas @LynnPatchett last edited by

              That is the code that I have currently in my htaccess file. However, the issue is that with this code in my htaccess file I am having an issue where when i type in the URL to log into the site;

              domain.com/admin

              With the redirect active I get redirected to the following URL structure;

              domain.com/index.php?q=admin

              which is a page that does not exist and therefore gives me a 404 error.

              If I remove

              RewriteEngine On
              RewriteCond %{HTTP_HOST} ^www.yourdomain.com$ [NC]
              RewriteRule ^(.*)$ http://yourdomain.com/$1 [R=301,L]

              I can log in. However, this brings back all of the duplicate www. and non-www. issues.

              LynnPatchett 1 Reply Last reply Reply Quote 0
              • LynnPatchett
                LynnPatchett @Highline_Ideas last edited by

                Hi Andrea,

                Is that the only code you have in the htaccess file, or are there more lines? What cms are you using?

                it seems to me that your cms (or something else) is trying to rewrite internal site search terms (hence the q=admin) but there must be more in your htaccess file for this to be happening. Care to mention the site so I can have a quick look?

                Highline_Ideas 1 Reply Last reply Reply Quote 0
                • Highline_Ideas
                  Highline_Ideas @LynnPatchett last edited by

                  The following is the full htaccess file for the site in question. The CMS that we are using on this site is drupal, with cPanel on the backend server side. I originally thought there was a line that of code that was causing this ( I will be honest, I do not know what each line commands) but when I checked it against other htaccess files the code appeared to be the same.

                  Options +Indexes FollowSymLinks +ExecCGI

                  Order allow,deny
                  Allow from all

                  RewriteEngine on

                  RewriteBase /

                  RewriteCond %{REQUEST_FILENAME} !-f

                  RewriteCond %{REQUEST_FILENAME} !-d

                  RewriteCond %{REQUEST_URI} !=/favicon.ico

                  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

                  RewriteCond %{HTTP_HOST} ^www.domain.com$
                  RewriteRule ^(.*)$ "http://domain.com/$1" [R=301,L]

                  1 Reply Last reply Reply Quote 0
                  • LynnPatchett
                    LynnPatchett last edited by

                    Hi Andrea,

                    This looks like a drupal issue, not a cpanel issue and I am not that familiar with Drupal.

                    That being said, are you sure the above htaccess is the complete file that works? If you remove the lines that you say create the issue, you still have this line: RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] which is the one that handles rewriting urls to the form q=admin.

                    You could try moving the 2 lines of code: 
                    RewriteCond %{HTTP_HOST} ^www.domain.com$
                    RewriteRule ^(.*)$ "http://domain.com/$1" [R=301,L]

                    To immediately below the  'RewriteEngine on' line (and obviously putting your domain in place of domain.com) so that they run first before the rest of the rules. This might work, but to me the above looks like it will be rewriting to q=admin anyway, so maybe this is a drupal setup issue that I am unfamiliar with.

                    Highline_Ideas 1 Reply Last reply Reply Quote 1
                    • Highline_Ideas
                      Highline_Ideas @LynnPatchett last edited by

                      Lynn,

                      Good morning. I tried the above suggestion and it worked! Thank you for your help with this issue!

                      1 Reply Last reply Reply Quote 0
                      • 1 / 1
                      • First post
                        Last post
                      • Redirect Plugin: Redirecting or Rewriting?
                        HashtagHustler
                        HashtagHustler
                        0
                        3
                        230

                      • HTTPS Login on HTTP Site | 301 or 302 Redirect?
                        Cyrus-Shepard
                        Cyrus-Shepard
                        0
                        4
                        1.2k

                      • Duplicate Errors from Wordpress login redirects
                        GregDixson
                        GregDixson
                        0
                        6
                        750

                      • Login required pages that redirect back to the post
                        CleverPhD
                        CleverPhD
                        0
                        2
                        78

                      • Redirecting a redirect - thoughts?
                        MikeRoberts
                        MikeRoberts
                        0
                        2
                        165

                      • Can I make 301 redirects on a Windows server (without access to IIS)?
                        ThompsonPaul
                        ThompsonPaul
                        0
                        5
                        10.8k

                      • Login redirect 302
                        Anthony_NorthSEO
                        Anthony_NorthSEO
                        0
                        9
                        2.3k

                      • Redirect
                        nyanainc
                        nyanainc
                        0
                        3
                        388

                      Get started with Moz Pro!

                      Unlock the power of advanced SEO tools and data-driven insights.

                      Start my free trial
                      Products
                      • Moz Pro
                      • Moz Local
                      • Moz API
                      • Moz Data
                      • STAT
                      • Product Updates
                      Moz Solutions
                      • SMB Solutions
                      • Agency Solutions
                      • Enterprise Solutions
                      • Digital Marketers
                      Free SEO Tools
                      • Domain Authority Checker
                      • Link Explorer
                      • Keyword Explorer
                      • Competitive Research
                      • Brand Authority Checker
                      • Local Citation Checker
                      • MozBar Extension
                      • MozCast
                      Resources
                      • Blog
                      • SEO Learning Center
                      • Help Hub
                      • Beginner's Guide to SEO
                      • How-to Guides
                      • Moz Academy
                      • API Docs
                      About Moz
                      • About
                      • Team
                      • Careers
                      • Contact
                      Why Moz
                      • Case Studies
                      • Testimonials
                      Get Involved
                      • Become an Affiliate
                      • MozCon
                      • Webinars
                      • Practical Marketer Series
                      • MozPod
                      Connect with us

                      Contact the Help team

                      Join our newsletter
                      Moz logo
                      © 2021 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
                      • Accessibility
                      • Terms of Use
                      • Privacy