Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Website and Server Administration Forum


You are currently viewing our Website and Server Administration Forum as a guest. Please register to participate.
Login



Reply
.htaccess Redirecting Issue with New Host
Old 12-25-2008, 07:53 AM .htaccess Redirecting Issue with New Host
Kiros72's Avatar
Average Talker

Posts: 18
Name: Kiros
Location: Albany, LA - USA
Trades: 0
I just recently switched to a new host with a VPS package. I love the improvement in performance, but there are a few anomalies - one of them being a redirect issue.

Before I begin with the description, I want to note that my website was previously on a different server that had Apache v1.3.37 installed. This new server has Apache v2.2.11 installed and PHP compiled with Suhosin. I'm not sure if that would make any difference for the redirecting or not.

Now the problem is that I've had a .htaccess written for several (more than 4) months that worked properly in ever way, and now with this new host, the redirects are showing strange symptoms.

For the sake of demonstration, I'm going to keep the actual links to the site in place until this issue is resolved. If you go to Virtual Teen, there are several links at the top. Each of these links point to a redirect (such as /topics/community when the actual call would be topics.php?category=community). Whenever a link is visited, it changes the link to include the query within the URL.

In other words, going to this URL:
http://www.virtualteen.org/topics/community

... Makes it change the URL to this:
http://www.virtualteen.org/topic/com...gory=community

I keep everything neatly organized, so there are actually real directories for every link - as long as it has a subsection.

So this URL:
http://www.virtualteen.org/topics/community

... Actually exists (/topics/community/), but the redirected link actually points to this URL:
http://www.virtualteen.org/topics.ph...gory=community

... And it serves this content:
http://www.virtualteen.org/topics/community.php

Every subsection link found in the community page would serve content from /topics/community/ and so on.

Strangely enough, this phenomenon does not happen when there is not a subsection directory. So if this URL was accessed:
http://www.virtualteen.org/topics/community/blogs

... The redirect would work properly because there is not actually a /blog/ directory within /community/. It just grabs the blogs.php found in there.

Also, this doesn't seem to happen if a trailing slash is added to the URLs For instance, http://www.virtualteen.org/topics/parents/ works properly but it doesn't without the trailing slash. However, I don't want a trailing slash because I don't want these links thought of as directories.

I'm describing this in such detail because I think that this (the directory/script structure) might have to do with it.

Here is my .htaccess file.

Code:
<Files .htaccess>
order allow,deny
deny from all
</Files>

Options +FollowSymLinks
DirectoryIndex index.php

IndexIgnore *

RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} !^www\.virtualteen\.org$
RewriteRule ^(.*)$ http://www.virtualteen.org/$1 [R=301,L]

RewriteCond %{REQUEST_URI} ^/topics/downtime$
RewriteRule ^(.*)$ http://www.virtualteen.org/down.htm? [R=302,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(forums/)?index\.(php|html?)\ HTTP/
RewriteRule ^(forums/)?index\.(php|html?)$ /%1 [R=301,L]

RewriteCond %{REQUEST_URI} ^/forums//(.*)$
RewriteRule ^forums//(.*)$ forums/%1 [R=301,L]

RewriteCond %{REQUEST_URI} ^/topics/community/forums$
RewriteRule ^(.*)$ http://www.virtualteen.org/topics/community/forums-info? [R=302,L]

RewriteCond %{REQUEST_URI} ^/topics/parents/alcoholc$
RewriteRule ^(.*)$ http://www.virtualteen.org/topics/parents/alcoholic? [R=302,L]

RewriteCond %{REQUEST_URI} ^/topics/parents/chldabuse$
RewriteRule ^(.*)$ http://www.virtualteen.org/topics/parents/child-abuse? [R=302,L]

RewriteCond %{REQUEST_URI} ^/topics/parents/eval$
RewriteRule ^(.*)$ http://www.virtualteen.org/topics/parents/evaluate? [R=302,L]

RewriteCond %{REQUEST_URI} ^/topics/parents/fostercare$
RewriteRule ^(.*)$ http://www.virtualteen.org/topics/parents/foster-care? [R=302,L]

RewriteCond %{REQUEST_URI} ^/topics/parents/gayteens$
RewriteRule ^(.*)$ http://www.virtualteen.org/topics/parents/gay-lesbian? [R=302,L]

RewriteCond %{REQUEST_URI} ^/topics/parents/hs_develop$
RewriteRule ^(.*)$ http://www.virtualteen.org/topics/parents/high-school-develop? [R=302,L]

RewriteCond %{REQUEST_URI} ^/topics/parents/learningdis$
RewriteRule ^(.*)$ http://www.virtualteen.org/topics/parents/learning-disability? [R=302,L]

RewriteCond %{REQUEST_URI} ^/topics/parents/medquest$
RewriteRule ^(.*)$ http://www.virtualteen.org/topics/parents/med-questions? [R=302,L]

RewriteCond %{REQUEST_URI} ^/topics/parents/parentmi$
RewriteRule ^(.*)$ http://www.virtualteen.org/topics/parents/mental-parents? [R=302,L]

RewriteCond %{REQUEST_URI} ^/topics/parents/midsch_develop$
RewriteRule ^(.*)$ http://www.virtualteen.org/topics/parents/middle-school-develop? [R=302,L]

RewriteCond %{REQUEST_URI} ^/topics/parents/psychmed$
RewriteRule ^(.*)$ http://www.virtualteen.org/topics/parents/psych-meds? [R=302,L]

RewriteCond %{REQUEST_URI} ^/topics/parents/sexualabuse$
RewriteRule ^(.*)$ http://www.virtualteen.org/topics/parents/sexual-abuse? [R=302,L]

RewriteCond %{REQUEST_URI} ^/topics/parents/stepfmly$
RewriteRule ^(.*)$ http://www.virtualteen.org/topics/parents/step-family? [R=302,L]

RewriteCond %{REQUEST_URI} ^/topics/parents/talksex$
RewriteRule ^(.*)$ http://www.virtualteen.org/topics/parents/talk-sex? [R=302,L]

RewriteCond %{REQUEST_URI} ^/topics/parents/teendrug$
RewriteRule ^(.*)$ http://www.virtualteen.org/topics/parents/teen-drug? [R=302,L]

RewriteCond %{REQUEST_URI} ^/topics/parents/violentbehavior$
RewriteRule ^(.*)$ http://www.virtualteen.org/topics/parents/violent-behavior? [R=302,L]

RewriteCond %{REQUEST_URI} ^/topics/parents/wherehelp$
RewriteRule ^(.*)$ http://www.virtualteen.org/topics/parents/where-find-help? [R=302,L]

RewriteRule ^topics/([^/]+)/([^/]+)/([^/]+)/?$ topics.php?category=$1&section=$2&page=$3 [L] 
RewriteRule ^topics/([^/]+)/([^/]+)/?$ topics.php?category=$1&section=$2 [L] 
RewriteRule ^topics/([^/]+)/?$ topics.php?category=$1 [L]
RewriteRule ^topics/?$ topics.php [L] 

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /topics\.php\?category=([^&]+)&section=([^&]+)&page=([^\ ]+)\ HTTP/$
RewriteRule ^topics\.php$ topics/%1/%2/%3 [R=302,L] 

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /topics\.php\?category=([^&]+)&section=([^\ ]+)\ HTTP/$
RewriteRule ^topics\.php$ topics/%1/%2 [R=302,L] 

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /topics\.php\?category=([^\ ]+)\ HTTP/$
RewriteRule ^topics\.php$ topics/%1 [R=302,L]  

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /topics\.php\ HTTP/$
RewriteRule ^topics\.php$ topics [R=302,L] 

RewriteCond %{REQUEST_URI} ^/(urllist|sitemap).*$
RewriteRule ^((urllist|sitemap).*\.(xml|txt)(\.gz)?)$ forums/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]

RewriteCond %{REQUEST_URI} !^/forums/.*$
RewriteCond %{REQUEST_URI} ^/forum.*$ [NC,OR]
RewriteCond %{REQUEST_URI} ^/old_site_v./forum.*$
RewriteRule ^(.*)$ http://www.virtualteen.org/forums/? [R=302,L]

RewriteCond %{REQUEST_URI} !^/forums/.*$
RewriteCond %{REQUEST_URI} !^/old_site_v./.*$
RewriteCond %{QUERY_STRING} ^page=([^&]+)$ [OR]
RewriteCond %{REQUEST_URI} ^/aacap_(.+)\.shtml$
RewriteRule ^(.*)$ http://www.virtualteen.org/topics/parents/%1? [R=302,L]

RewriteCond %{REQUEST_URI} !^/forums/.*$
RewriteCond %{REQUEST_URI} ^/help.*$ [NC]
RewriteRule ^(.*)$ http://www.virtualteen.org/topics/about/help? [R=302,L]
I have changed all of the redirects to 302 (temporary) instead of 301 (permanent) in hopes that Google and other search engines will not index my site with these strange redirects.

Does anyone know how I could correct this issue? Maybe it's a setting in Apache? Maybe it's a change from Apache 1 to Apache 2? Because this did not occur on my old host.

Last edited by Kiros72; 12-25-2008 at 07:57 AM..
Kiros72 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-28-2008, 09:44 AM Re: .htaccess Redirecting Issue with New Host
Kiros72's Avatar
Average Talker

Posts: 18
Name: Kiros
Location: Albany, LA - USA
Trades: 0
I'm still having these issues.

Can anyone offer a possible solution?
Kiros72 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to .htaccess Redirecting Issue with New Host
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.37185 seconds with 12 queries