Infinite Redirect Loop without trailing slash, please help
-
I've been searching for an answer all day, I can't seem to figure this out.
When I Fetch my blog as Google(http://www.mysite.com/blog) WITHOUT a trailing slash at the end, I get this error:
The page seems to redirect to itself. This may result in an infinite redirect loop
**HTTP/1.1 301 Moved Permanently**
When I Fetch my blog as Google WITH the trailing slash at the end(http://www.mysite.com/blog/), it is fine without errors.
When I pull it up in a browser comes up fine both with and without the trailing slash.
My .htaccess file in the root directory contains this:
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index.htm\ HTTP/
RewriteRule ^index.htm$ http://www.mysite.com/ [R=301,L]
RewriteCond %{HTTP_HOST} ^mysite.com$
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]My .htaccess file in the blog directory contains this:
BEGIN WordPress
<ifmodule mod_rewrite.c="">RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_URI} ^./index.php/. [NC]
RewriteRule ^index.php/(.*)$ http://www.mysite.com/blog/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]</ifmodule>END WordPress
Do I have something incorrectly coded in these .htaccess files that could be causing this? Or is there something else I should look at? Thank you for any help!!
-
I combined the htaccess files (putting the blog rewrite rule to the bottom of the file) now having just one htacess in the root directory and unfortunately it did not work. When I tried it, all the links on the blog would not work, they were all "page not found" so I reverted it back to what I originally had... Here is what the combined htaccess file looked like:
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index.htm\ HTTP/
RewriteRule ^index.htm$ http://www.example.com/ [R=301,L]
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]<ifmodule mod_rewrite.c="">RewriteEngine On
RewriteBase /blog/
RewriteCond %{THE_REQUEST} ^./index.php/. [NC]
RewriteRule ^index.php/(.*)$ http://www.example.com/blog/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]</ifmodule>Thanks again for any insight!
-
Hey Debora,
Any luck?
Keith
-
Hello Debora,
Make sure you keep copies of your .htaccess files before you make changes and, if you can, use a test site to test your changes first before you make changes on your live website.
I'm not sure how your website is set up so I don't know if combining the two files will accomplish what you are looking for.
Whatever you do, make sure you have backups.
-
Yes as I said above
-
Thanks for your response Keith, I'll give it a try and let you know!
-
Thanks George. Please forgive me, I am a newbie at this! I took a look at the link you provided, and I don't fully understand what they are explaining. What I did understand is that having 2 htaccess files in different directories caused a problem with their code. Do you think combining the two files into one on the root directory will make a difference for me?
-
Sorry, I completely misread this question (I missed the part where you said you had to .htaccess files!).
Yes put one .htaccess file in the root dir, add the blog rewrite rule to the bottom of the file.
Let me know how it goes.
Keith
-
Thanks Keith. I tried it and it is still looping. Do you think it has something to do with having 2 different .htaccess files? Should I combine them into just one in the root directory?
-
Yuk mod_rewrite...
Try:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index.php\ HTTP/
RewriteRule ^index.php$ http://www.example.com/blog/ [R=301,L]You may wish to add $1 on the end
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index.php\ HTTP/
RewriteRule ^index.php$ http://www.example.com/blog/$1 [R=301,L]Let me know if that stops it looping...
Keith
-
Try here. Maybe that will help.
Edit: Pretty sure it's your root directory .htaccess file that is causing the looping. I'd start with that.
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 help with Robots.txt
An eCommerce site built with Modx CMS. I found lots of auto generated duplicate page issue on that site. Now I need to disallow some pages from that category. Here is the actual product page url looks like
Intermediate & Advanced SEO | | Nahid
product_listing.php?cat=6857 And here is the auto generated url structure
product_listing.php?cat=6857&cPath=dropship&size=19 Can any one suggest how to disallow this specific category through robots.txt. I am not so familiar with Modx and this kind of link structure. Your help will be appreciated. Thanks1 -
Help with https// redirects
Hey there
Intermediate & Advanced SEO | | Jay328
I have a client who just moved from a self hosted CMS to Adobe Catalyst (don't ask!)
The problem: Their url indexed with google is https://domain.com, Adobe Catalyst does not support third party SSL certificates or https domains. Now when people google them https://domain.com shows up in search, HOWEVER it does not have a trusted certificate and a pop up window blocks the site. They are a mortgage company so SSL is really not needed. What can I do to get google to recognize the site at http: vs. https? Would this be something in GWMT? Thanks!0 -
Need help for new website!
I want to a make new website. Can you please advise me what all things are involved which I should keep in mind before and during the website preparation. Like how to make pages, what to include in website, best way to create pages etc. Please provide me the link where I can study all the above information. I am planning to create global printing website.
Intermediate & Advanced SEO | | AlexanderWhite0 -
Please help with some content ideas
I was reading this post http://www.clambr.com/link-building-tools/ about how he had basically outreached to experts in the field and each one had shared this post with their followers. I am wondering how this could translate to our small business marketing and design blog I am really struggling for content ideas that will work in regards to popularity and link building.
Intermediate & Advanced SEO | | BobAnderson0 -
Domain Name Redirect Question
My agency just built a new website for a client who is a franchisee. It's not launched yet - it's currently under an IP address. I suggested to client that he buy a keyword-rich domain name for it, which he did. Then he found out that the franchisor will not allow it to be his main domain name. They want him to use a domain name with the franchisor name in it. But they WILL allow him to put a 301 redirect on that franchisor-approved domain name, and redirect it to his keyword-rich domain name. He is interested in having my agency perform an SEO Campaign for this new website. But would SEO and link marketing work for a website that has a new non-keyword domain name that 301 redirects to a new keyword-rich domain name?
Intermediate & Advanced SEO | | netsites0 -
What next to help with my rankings
I'm after a fresh set of eyes and any suggestions to help me with my site on what next I should be doing to help increase rankings. The site is: http://bit.ly/VR6xIm Currently the site is ranking around 9-11th on google.co.uk for it's main term which is the name of the site. The site is around a year old, when it launched it went initially up towards positions 3-5 but has since settled at around where it is now. I have a free tool webmasters can use to implement our speed test into their sites which also includes a link back to our site in it to recognise that we are providing the tool for free, I periodically change the link achor text so it is not always the same anchor text that every site uses. Is there anything obvious I should be doing or that is missing that would help with my rankings? *Just as a note, I am not after a review on the actual speed test on the site, a new one will be developed to help further increase accuracy.
Intermediate & Advanced SEO | | Wardy0 -
Redirect 301
Hi, I `m redirecting some pages in htaccess The first 15 pages that i redirected it worked. But the last 3 dont work, and i cant figure it out why it is not working. Redirect 301 /analyseverktoy/ /webanalyse
Intermediate & Advanced SEO | | SGacic
Redirect 301 /index.php/ledige-stillinger/ /
Redirect 301 /?page_id=352/ / Anu suggestions?0 -
Certain Pages Not Being Indexed - Please Help
We are having trouble getting a bulk of our pages indexed in google. Any help would be greatly appreciated! The Following Page types are being indexed through escaped fragment: http://www.cbuy.tv/#! http://www.cbuy.tv/celebrity#!65-Ashley-Tisdale/fashion/4097-Casadei-BLADE-PUMP/Product/175199 <cite>www.cbuy.tv/celebrity/155-Sophia-Bush#!</cite> However, all our pages that look like this, are not being indexed: http://www.cbuy.tv/#!Type=Photo&id=b1d18759-5e52-4a1c-9491-6fb3cb9d4b95&Katie-Holmes-Hot-Pink-Pants-Isabel-Marant-DAVID-DOUBLE-BREASTED-Wool-COAT-Maison-Pumps-Black-Bag
Intermediate & Advanced SEO | | CBuy0