CPanel Redirect not allowing login access.
-
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.
-
Lynn,
Good morning. I tried the above suggestion and it worked! Thank you for your help with this issue!
-
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.
-
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 allRewriteEngine 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] -
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?
-
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;
With the redirect active I get redirected to the following URL structure;
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.
-
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?
-
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.
-
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.
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Need advice on redirects
Hi, I have new web addresses for my subpages. None if them have external links. Should I do redirects to the new pages or just leave the old pages in 404 and let google crawl and rank the new page. I am asking because my current pages don’t have a good ranking and I am thinking starting with a clean url is better. Thank you,
Intermediate & Advanced SEO | | seoanalytics1 -
Should I do a redirect
Hello, I am building a new website with a new web address for subpages. The domain name stays the same. I am wondering if I should do redirect to the few pages that have an outside link going to them. I noticed all my subpage that don't have any external link have an authority of 18. I only have 1 subpage that has 2 external links and 1 of them has a spam score of 32 and then other one of 1. My website is about a 100 pages. What should I do for my subpages redirect , not redirect, redirect only the ones that have external links ? Thank you,
Intermediate & Advanced SEO | | seoanalytics0 -
Redirect chains from switch to HTTPS
Hi, We have a client who recently switched their site to https:// The rule to force redirect non-secure URLs to https is in their .htaccess file: RewriteEngine on if non-SSL and one of these, redirect to SSL RewriteCond %{HTTPS} !on
Intermediate & Advanced SEO | | roundabout
RewriteRule ^(.*)$ https://www.clientdomain.com/$1 [R=301,L] However, they also have simple redirects below this rule that redirect one page to another, such as: Redirect 301 /old.php https://www.clientdomain.com/new.php This is causing redirect chains like this: (A) http://www.clientdomain.com/old.php > (B) https://www.clientdomain.com/old.php > (C) https://www.clientdomain.com/new.php Is there any way to rewrite the rules in .htaccess to get rid of these redirect chains? So that URL A goes directly to URL C? Thank you!1 -
Adventurous 301 redirection chain
Picture this - if you have a spirit for adventure! Client builds Alpha****Domain.com Then builds a number of backlinks to Alpha****Domain.com Client also creates a number of 301 redirects from several older domains to AlphaDomain.com Client then changes Alpha****Domain.com to Beta****Domain.com They create 301 redirects from Alpha****Domain.com to Beta****Domain.com But then... they 'park' Alpha****Domain.com (ie. no longer accessible)! About one year later, client changes a whole bunch of URLs on Beta****Domain.com without keeping track of changes. Thankfully, the hosting service (Shopify) automatically creates some redirects, but it's more by accident than design! Questions: After step 6 above, are the 301 redirects created in steps 3 and 5 now totally redundant and broken? If AlphaDomain.com no longer exists, surely all redirects to and from this domain are broken? Or can they be recovered? What happens to all the backlinks originally created in step 2? Finally, can anything be done to recover lost URLs in step 7? Yes. What a mess!
Intermediate & Advanced SEO | | muzzmoz0 -
Hundreds of 301 Redirects. Remove Pages or Not?
Hi Mozers, I have a website that has literally got hundreds of 301 redirects. I had a close look at these URLs and only some of them have backlinks to it and remaining all of them are not indexing in Google and has got not backlinks at all. Based on what I have noticed experts mentioning, loads of 301 redirects can potentially slow down the site speed. In a case like the website I have, should I completely take off the pages from website to reduce the number of 301 redirects or should I leave 301 redirects? There is no traffic or backlinks coming from these URLs. Malika
Intermediate & Advanced SEO | | Malika10 -
Redirecting index.html to the root
Hi, I was wondering if there is a safe way to consolidate link juice on a single version of a home page. I find incoming links to my site that link to both mysite.com/ and mysite.com/index.html. I've decided to go with mysite.com/ as my main and only URL for the site and now I'd like to transfer all link juice from mysite.com/index.html to mysite.com/
Intermediate & Advanced SEO | | romanbond
When i tried 301 redirect from index.html to the root it created an indefinite loop, of course. I know I can use a RewriteRule.., but will it transfer the juice?? Please help!5 -
Are there any negatives to channeling my links through a 301 redirect?
I'm channeling 1000's of links through another url with a 301 redirect. I've thought this through and can't see any downside to doing this, but I want to get your opinion. Can you see any downside to doing this? With regards to passing anchor text, PR, PA, etc? Since this is done with sites all the time when they change urls, I can't see Google being able to penalize me for this....can you? What do you think?
Intermediate & Advanced SEO | | Brian-M0 -
301 Redirect for 2500 pages
Hi, We have an existing site done in DNN and we recreated it on a new platform (EPiServer) and now we're going live. However, there are 2500+ page URLs from the old site which is not exisitng on the new site. What do you reckon is the best way we can address this? Do we create a 301 redirect individually for each of these pages? These 2500+ pages have a domain authority 34-35 and I think it's best that we retain those. We'll be using the same domain name. Suggestions for ways to approach this issue would be greatly appreciated. I have access to the server and IIS. *Also, how do I create a virtual page in IIS? and redirect it to another URL within the site? Thanks.
Intermediate & Advanced SEO | | Peter.Huxley590