Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have an URL which is 301 redirecting but I cannot find where or how it is happening and wanted some checks to perform if possible?

  • I've checked .htaccess - it's not there
  • I've checked cPanel in redirects section - it's not there
  • In WordPress, I have the redirection plugin active and it's not there either

Is there anywhere else that could be issuing redirects? I'm at a loss to find out where and how the page is redirecting!

share|improve this question
    
Do you have specific directory .htacess files? Sometimes there are multiple copys on different directory levels. –  Switchfire Oct 18 '13 at 8:09
    
If it's not in any of those you've mentioned, it's likely being controlled in a .php file somewhere. Try disabling the WP plugin though just to be sure and then see if the URL is still redirecting. –  zigojacko Oct 18 '13 at 11:35
    
What is the URL question redirecting to? Is it going off-site or from one page/post to another? –  JCL1178 Oct 19 '13 at 5:55

2 Answers 2

Any of the following can cause redirects:

  • .htaccess files (cPanel usually edits one of these files)
  • Apache configuration files (usually httpd.conf)
  • In code (such as a plugin) that sets a Location: header.

To locate the source of redirects, I usually search all the source code using recursive grep on the command line. I usually search for the URL of the redirect.

URLs can be stored in the database as well (some WordPress plugins might do that), so it would be good to look there as well.

If it is malware that hacked your site and caused the redirect, the URL may be obfuscated in the source code to make finding it harder.

share|improve this answer

I just had this happen, took me a while to find the setting but if you are using Plesk then check this setting from Plesk Panel.

Navigate to Home > Subscriptions > yourdomain.com > Websites & Domains > yourdomain.com > Hosting Settings. Then check "Preferred domain" dropdown you can choose www. or domain.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.