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
-
Incomplete Redirect for Domain Migration?
One year ago we migrated domain "X" to domain "Y". We did the proper redirects and used Google Search Console. Everything was done by the book. Now when we enter "Site: X" in Google about 650 results listing the old domain still come up. When clicked these redirect to the new domain. My SEO says that the old domain should not be indexed by Google, that these pages with the old domain should not appear. Is this in fact an incomplete domain migration? Our search traffic dropped considerably when we migrated the domain a year ago. My SEO thinks this may explain the drop. Thanks,
Intermediate & Advanced SEO | | Kingalan1
Alan0 -
A Really Specific Question about 301 Redirect Strategies
Hi there: As part of a site redesign project, we've been doing a lot of 301 redirects, as we retire old URLs or rename them. My question is: is it necessary to redirect ALL old URLS? What about URLs with no links and low authority? Are these really necessary to redirect, since they're not referenced on the web and there's obviously a global redirect happening at the level of the root domain? Just curious; I'm not sure I've ever really understood this...
Intermediate & Advanced SEO | | Daaveey0 -
How long should I keep the 301 redirect file
We've setup an new site and many pages don't exist anymore (clean up done). But for many of them we have new pages with new url's. We've monitored the 404 and have now many URL's redirected with 301 (apache file). How long should we keep this in place? Checking all links manually to see of new url is in place of the old url (in google) is too much work. tx!
Intermediate & Advanced SEO | | KBC0 -
What is true impact of permanent magento redirects?
Hi everyone, I got a tough technical SEO question, that is bugging almost everyone in the (ecommerce) company at the moment. Due to a very "unhealthy" structure of Magento folders, with different countries using same folders in different store views, many of our URL's do change almost on a weekly basis and this is terrifying us. What happens is, that there is a "-numberx"(ex. /category/product-1.html) added to hundreds of URLs so that we are more and more concerned about the impact on SEO. I checked the redirect information with the Moz Toolbar and saw, the following information: http://prntscr.com/81v23e So, even though we had URLs with /category/product-1.html, /category/product-2.html,... the redirect seems to go straight to the last number. My question? -Can this be interpreted as one redirect and therefore it is "less" painful from an SEO point of view?
Intermediate & Advanced SEO | | ennovators
-As we do not have a constant target URL, where does the link juice go if the target page constantly keeps changing (number goes still up) Any advice would be much appreciated. Thanks0 -
303 redirect
Hi, 303 redirect is a good thing or not ? I have a homepage in 2 languages FR and EN > mywebsite.com/fr/ and mywebsite.com/en/. A 303 redirect is on mywebsite.com to mywebsite.com/fr/. Thanks D.
Intermediate & Advanced SEO | | android_lyon0 -
How important is having a 301 redirect?
Is having a 301 redirect a must for rankings when it comes to the www and non-www version of a site? I am on the bottom of page 1 for my main key phrases but I can't do a 301 redirect with my web host that I've been with for over a year. I've been considering changing web host (currently with Yahoo) but I also have concerns about transferring the site and the impact it might have because of the changing ip address. So my options are Stay Put Change Web host Which would you recommend?
Intermediate & Advanced SEO | | bronxpad0 -
Access Denied
Our website which was ranking at number 1 in Google.co.uk for our 2 main search terms for over three years was hacked into last November. We rebuilt the site but had slipped down to number 4. We were hacked again 2 weeks ago and are now at number 7. I realise that this drop may not be just a result of the hacking but it cant' have helped. I've just access our Google Webmaster Tools accounts and these are the current results: 940 Access Denied Errors 197 Not Found The 940 Access Denied Errors apply to Wordpress Blog pages. Is it likely that the hacking caused the Access Denied errors and is there a clear way to repair these errors? Any advice would be very welcome. Thanks, Colin
Intermediate & Advanced SEO | | NileCruises0 -
After the 301 redirect
Hi all, A quick question, after you have setup your 301 re-directs in .htaccess - is it necessary to keep your content in the original domains directory? My thinking is that requests do get as far as referencing the directory, thus it should be safe to delete all the files on the old domain? Thanx!
Intermediate & Advanced SEO | | gazza7770