Solved

Redirect mod_rewrite killed my Blog?

Posted on 2008-10-24
13
1,781 Views
Last Modified: 2010-04-21
I added the below code to my htaccess file to handle the problems associated with:

http://www.mysite.com
http://mysite.com

www.mysite.com/index.php
www.mysite.com/

However, I have a wordpress blog that is located at mysite.com/blog
Without the mod_rewrite enabled when I type http://www.mysite.com/blog  it always redirects to
http://mysite.com/blog

After enabling the mod_rewrite I've tried both and get an error.  Something to the effect of:

"The browser has stopped trying to retrieve the requested item. The site is redirecting the request in a way that will never complete."

Obviously the mod_rewrite caused this behavior, but I'm thinking that Wordpress might be playing a part in the problem.

It might help to mention I created a directory called blog and placed the index.php for Wordpress into it and added :  require('../wordpress/wp-blog-header.php'); to get it to work with the original install directory of wordpress.

Any Help is Greatly Appreciated.

Dan
## The basics to get mod_rewrite going ####################

#RewriteBase /

RewriteEngine On

RewriteCond %{THE_REQUEST} /index\.php [NC]

RewriteRule ^(.*/)?index\.php$ /$1 [R=301,L]

 

RewriteCond %{HTTP_HOST} ^inptech.com [NC]

RewriteRule ^(.*)$ http://www.inptech.com/$1 [L,R=301]

###########################################################

Open in new window

0
Comment
Question by:dyoung520
  • 7
  • 3
  • 2
  • +1
13 Comments
 
LVL 27

Expert Comment

by:caterham_www
ID: 22800076
> The site is redirecting the request in a way that will never complete."

And to which URL?
0
 

Author Comment

by:dyoung520
ID: 22800142
With the Mod_Rewrite Rule in affect... If I type either of the following:

http://www.inptech.com/blog
http://inptech.com/blog

I get the error in the browser - from the browser (ff).

Without the Mod_Rewrite rule in affect... If I type the following:

http://www.inptech.com/blog
it redirects to:

http://inptech.com/blog
and works but don't know why it's redirecting??

Does that make sense?
0
 

Author Comment

by:dyoung520
ID: 22800179
Here is the full error message I get:
#####################################################
Redirect Loop

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

The browser has stopped trying to retrieve the requested item. The site is redirecting the request in a way that will never complete.

    * Have you disabled or blocked cookies required by this site?
    * NOTE: If accepting the site's cookies does not resolve the problem, it is likely a server configuration issue and not your computer.
#####################################################
I think wordpress attempts to redirect to http://mysite.com/blog and my .htaccess file then attempts to redirect it back to www.mysite.com/blog


Thanks
0
 

Author Comment

by:dyoung520
ID: 22800192
I think it's wordpress problem and know very little about it... but I'm going through the files looking for any configuration settings.
0
 

Author Comment

by:dyoung520
ID: 22800308
I also use a Shared SSL where my site gets redirected for secured connections like so.

https://ssl4.westserver.net/mysite.com/customer_tools.php

It's screwing that up to... But think I could fix that with a more complicated mod_rewrite....

Maybe all this isn't worth it - It started with me being upset with Google indexing both my index.php and / variant - I was tired of looking at it in Webmaster tools......
0
 
LVL 27

Expert Comment

by:caterham_www
ID: 22800481
> I think wordpress attempts to redirect to http://mysite.com/blog and my .htaccess file then attempts to redirect it back to www.mysite.com/blog

Yes, but only in a 2nd step.

First, the server redirects the request http:/www.inptech.com/blog to www......com/blog/ (trailing slash) and then wordpress redirects to /blog/ but dropping the 3rd-level www (and the 2nd rewrite rule redirects again to www and WP to non-www.....)

May be you can configure WP to use www..... as domain? Or, otherwise, change your rule into
RewriteCond %{HTTP_HOST} ^www\.inptech\.com [NC]

RewriteRule ^(.*)$ http://inptech.com/$1 [L,R=301]

Open in new window

0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 12

Expert Comment

by:ShaneJones
ID: 22835201
Hi there is there anything else in your .htaccess file as my site uses the same rules as you on your htaccess and my blog is located at domain.com/blog and I have no issues with this redirection loop?

Shane


0
 

Author Comment

by:dyoung520
ID: 22835861
Here is my entire htaccess file that I inherited...
I've commented out the mod_rewrite for now until I figure the best solution.


Thanks!

# -FrontPage-
 

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
 

<Limit GET POST>

order deny,allow

deny from all

allow from all

</Limit>

<Limit PUT DELETE>

order deny,allow

deny from all

</Limit>

<Files *.inc>

order allow,deny

Deny from all

</Files>

<Files *.phpx>

order allow,deny

Deny from all

</Files>
 

AuthName www.mysite.com

AuthUserFile /www/mysite/_vti_pvt/service.pwd

AuthGroupFile /www/mysite/_vti_pvt/service.grp
 
 

#Options +FollowSymlinks
 
 
 

## The basics to get mod_rewrite going ####################

#RewriteBase /

#RewriteEngine On

#RewriteCond %{THE_REQUEST} /index\.php [NC]

#RewriteRule ^(.*/)?index\.php$ /$1 [R=301,L]

 

#RewriteCond %{HTTP_HOST} ^www\.mysite\.com [NC]

#RewriteRule ^(.*)$ http://mysite.com/$1 [L,R=301]

##Need to Fix the Shared SSL and Blog Problem

###########################################################
 

#OLD SITE 301 REDIRECTS
 

Redirect 301 /dcolor.php http://www.mysite.com/color_printing.php

Redirect 301 /dmail.php http://www.mysite.com/direct_mail.php

Redirect 301 /dentry.php http://www.mysite.com/data_management.php

Redirect 301 /emarket.php http://www.mysite.com/e-marketing.php

Redirect 301 /invoice.php http://www.mysite.com/invoicing.php

Redirect 301 /gdesign.php http://www.mysite.com/prepress.php

Redirect 301 /help.php http://www.mysite.com/help_overview.php

Redirect 301 /upoptions.php http://www.mysite.com/index.php

Redirect 301 /viaftp.php http://www.mysite.com/index.php

Redirect 301 /viadisk.php http://www.mysite.com/index.php

Redirect 301 /jobops.php http://www.mysite.com/index.php

Redirect 301 /contact.php http://www.mysite.com/contact_us.php

Redirect 301 /gmap.php http://www.mysite.com/maps.html

Redirect 301 /drj/login.php http://www.drj.com

Redirect 301 /index-2.php http://www.mysite.com/index.php

Redirect 301 /index-x.php http://www.mysite.com/index.php

Open in new window

0
 
LVL 25

Accepted Solution

by:
James Rodgers earned 500 total points
ID: 22849626
have you checked the blog url in wp settings?
what you are experiencing is an infinite loop as a result of the redirect, wp has a basic site url reference built in you probably need to update it to the path you want

most likely it is set as
http://mysite.com/blog
and with your rewrite it is trying to make it
http://www.mysite.com/blog
then wp tries to make it
http://mysite.com/blog
which will then loop

go to wp admin
then settings and update your blog url
0
 

Author Comment

by:dyoung520
ID: 22850687
Jester,

That was it!  I feel kinda dumb...

I still have to deal with the shared SSL problem before I'm finished.

https://ssl4.westserver.net/mysite.com/customer_tools.php

gets redirected to http://www.mysite.com/customer_tools.php

any advice on that one?
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 22850767
you should be able to access the admin settings at teh SSL link and change teh redirection, but that is really a separate question.

0
 

Author Closing Comment

by:dyoung520
ID: 31509818
Thanks!!
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 22850904
glad i could help


thanks for the points
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now