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
Solved

Redirect mod_rewrite killed my Blog?

Posted on 2008-10-24
13
1,787 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Best practice for a landing page 3 74
WordPress Nightmare 30 60
push logos in footer up higher 5 25
Divi Theme - extra fonts I don't want 13 40
Your personal information, where you live, your wedding information, and anything else personal may be located online and in many cases the aggregators who pulled this stuff did so without your permission. Here are ways that you can get rid of unwan…
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…

809 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