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
-
I have over 12,000 permanent redirects. Is this okay?
Hey guys, I have moved my website to http://www to https:/www. I use a plugin called Really Simple SSL on Wordpress. Now I have 12,000 permanent 301 redirects. It seems like my whole site has been moved. Is this the right way to do it? I am quite new to SEO and I quite don't understand if this is good or bad. From my intuition, it seems like a lot of redirects for Google bot to crawl through. Is there a better way to move to HTTPS without all these redirects? Thank you. Paul
Intermediate & Advanced SEO | | paultg0 -
Wrong redirect used
Hi Folks,
Intermediate & Advanced SEO | | Patrick_556
I have a query & looking for some opinions. Our site migrated to https://
Somewhere along the line between the developer & hosting provided 302 redirect was implemented instead of the recommended 301 (the 301 rule was not being honured in the htaccess file.)
1 week passed, I noticed some of our key phrases disappear from the serps 😞 When investigated, I noticed this the incorrect redirect was implemented. The correct 301 redirect has now been implemented & functioning correctly. I have created a new https property in webmaster tools, Submitted the sitemap, Provided link in the robots.txt file to the https sitemap Canonical tags set to correct https. My gut feeling is that Google will take some time to realise the problem & take some time to update the search results we lost. Has anyone experienced this before or have any further thoughts on how to rectify asap.0 -
Redirect ot new domain
Hello, Can someone give me advice on this specific situation: For now we have a website www.website.com/ Because of some specific business situation we want to move to .ca version but also we want to keep website.com - for U.S customers. Here's how I imagined to do this: 301 Redirect from www.website.com to website.ca. Because at this time website.com redirects to www.website.com I would remove the redirect and just keep it like website.com (so this will be new domain). Is this is the right solution? Regards, Nenad
Intermediate & Advanced SEO | | Uniline0 -
301 redirect to multiple domain
Hi guys, I have a domain A, B and C. The domain A was an association of two business and they are about to split. Parts of domain A are going to be redirect to domain B, but some content belong to the domain C. So my question : Is it possible to 301 redirect some pages from A to B and some other pages from A to C and if yes, what would be the impact on SEO ? Thanks a lot!
Intermediate & Advanced SEO | | StevePatenaude0 -
Homepage 302 Redirect For SSL
Hi All, My site, http://domain.com, currently has a 302 redirect from http://domain.com to https://domain.com. The reason we have an SSL cert is because we have a registration and log in form on the homepage (as well as log in options in the top bar of every page on the site - email/password). My question is: When taking SEO best practices into account, would we be better having a 301 redirect from http://domain.com to https://domain.com as most of our inbound links are directed to http://domain.com. Thanks for any help!
Intermediate & Advanced SEO | | Rogs.SEO0 -
Regular Expression / Wildcard Redirect Situation
I am dealing with an interesting situation. Here's what's going on: Current URLs Example1:
Intermediate & Advanced SEO | | NakulGoyal
www.domain.com/red-widgets-cid-1234.html
www.domain.com/red-widgets-cid-1234-1.html
www.domain.com/red-widgets-cid-1234-1-1.html Canonical on All Above URLs:
www.domain.com/red-widgets-cid-1234.html New URL:
www.domain.com/red-widgets-cid-4567.html Current URLs Example2:
www.domain.com/red-widgets-cid-1234+10.html
www.domain.com/red-widgets-cid-1234+10-1.html
www.domain.com/red-widgets-cid-1234+10-1-1.html Canonical on All Above URLs:
www.domain.com/red-widgets-cid-1234+10.html New URL:
www.domain.com/red-widgets-cid-6789.html I want to make sure all variations of the above URL redirect to the new url. What wildcard 301 redirect / regular expression can I use to tackle these ?0 -
Redirecting, then redirecting back
Hey, mozzers! My first question ever... I have a client who has (fictitionally) WickerPatioHomeStore.com, which features wicker home decor. Not too long ago, they wanted a shorter, easier URL, so they redirected to another domain they own, WickerPatio.com (again, fictional). They saw somewhat of a drop in traffic, and wonder if there's a correlation with the words "home store" not being in their domain any more. When considering the two, I figure that relevant factors would be age of domains, history of content of the domains, and inbound links to each domain. Any thoughts on other things to consider? Thanks very much!! ~ Scott
Intermediate & Advanced SEO | | GRIP-SEO0 -
Question about 301 redirect for trailing / ?
I am cleaning up a fairly large site. Some pages have a trailing slash on the end some don't. Some of the existing backlinks built used a trailing slash in the url and some didn't. We aren't concerned with picking a particular one but just want to get one set and stick to it from now on. I am wondering, would I clean this up within the same redirect in the htaccess file that takes care of the www and non www? example RewriteEngine On
Intermediate & Advanced SEO | | PEnterprises
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.domain.com/ [NC]
RewriteRule ^(.*)$ http://domain.com$1 [L,R=301] I currently use that to redirect the www. to the non www as you can see. However here is what I was confused about. Would this code be enough to redirect ALL pages with a / to the ones without? or would I also need to add another code (so there is 2) to my htaccess like below? RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^domain.com/ [NC]
RewriteRule ^(.*)$ http://domain.com$1 [L,R=301] RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.domain.com/ [NC]
RewriteRule ^(.*)$ http://domain.com$1 [L,R=301] That way, now, even the non www pages with a trailing slash will redirect to the non www without the trailing slash. Hopefully you understand what I am getting at. I just want to redirect EVERYTHING to the non www WITHOUT a / Thank you Jake0