Solved

Redirect mod_rewrite killed my Blog?

Posted on 2008-10-24
13
1,792 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Flexible connectivity for any environment

The KE6900 series can extend and deploy computers with high definition displays across multiple stations in a variety of applications that suit any environment. Expand computer use to stations across multiple rooms with dynamic access.

 

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
 
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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
A/B testing is a simple and effective trick to get to know your audience, increase website conversions and make the most out of your online ad campaigns. It's widely available and doesn't need much tech knowledge to be executed, but the results it y…
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
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.

733 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