Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google      Sign In   
  • Create Account

Subscribe to HRA Now!

 



Are you a Google Analytics enthusiast?

Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE! 

 



 

 www.CustomReportSharing.com 

From the folks who brought you High Rankings!



Photo
- - - - -

Permanent 301 Redirect


  • This topic is locked This topic is locked
320 replies to this topic

#286 gburks

gburks

    HR 1

  • Members
  • Pip
  • 3 posts

Posted 17 November 2006 - 12:32 PM

Beautiful! That worked!

FYI, the hosting company is GoDaddy. I would expect that they have Apache configured to do something strange behind the scenes, and given the size of their company, many many people would have this issue. Although their tech support is usually ok, they were unknowledgable and unhelpful on this issue.

Thanks again!

Edit to remove live links per [url=http://www.highrankings.com/forum/index.php?act=boardrules]Forum Rules[/url]. -- Torka

Edited by torka, 17 November 2006 - 12:46 PM.


#287 A. Lunde

A. Lunde

    HR 1

  • Members
  • Pip
  • 2 posts
  • Location:Aarhus, Denmark

Posted 20 November 2006 - 10:00 AM

I'm new to this, and it doesn't seem to do what I want it to do...

A part of my site has been located on a subdomain, and I need to move it all to a new domain, without changing the rest of the old domain (only the subdomain is moved).

I thought that this would do the trick:

CODE
RewriteEngine On
RewriteCond %{HTTP_HOST} subdomain\.domain1\.com [NC]
RewriteRule (.*) http://www.domain2.com/$1 [R=301,L]


...and my problem is that subdomain.domain1.com/index.htm redirects to http://www.domain2.c...omain/index.htm and it doesn't exist...

How do I get it to redirect to http://www.domain2.com/index.htm?

#288 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 20 November 2006 - 02:55 PM

I'm going to make a fairly large leap here, but my first guess would be that the subdomain files are actually stored on the server in a location that is something like /subdomain/file.htm from the root level of the web space. Is this assumption right?

A couple of possible solutions...

You could control it via DNS by pointing the subdomain.domain1.com address to a the IP address of the new domain, if they're on different servers. Then do your detection/redirection there.

Other than that, you might be able to use a second RewriteCond to variablize the filename using something like %{REQUEST_URI} /(.*) and then drop the $1 in your RewriteRule altogether. Replacing it with %1 so that it pulls it from the REQUEST_URI variable instead.

#289 A. Lunde

A. Lunde

    HR 1

  • Members
  • Pip
  • 2 posts
  • Location:Aarhus, Denmark

Posted 20 November 2006 - 03:19 PM

Wow... thanks!

That did the trick... the {REQUEST_URI} variable was just what I needed... I spent all day looking for this solution in various forums, and I couldn't find it anywhere.

I also considered using the DNS settings, but I wasn't sure if it would return the 301 or how I would have to do to get it right.

It works now... mod_rewrite is really cool!

Thanks again!

#290 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 20 November 2006 - 05:01 PM

Glad it worked out quickly and that you picked up on a lot of stuff I didn't say A. Lunde. And welcome. hi.gif

Just for the record and for those reading along, the DNS change would not send any type of 301 or other status code. That mention was only in case your subdomain was on another server (say for instance a shopping cart site) and you could control things that way.

Doesn't sound like the situation you had, and as I've always said it's tough to generalize about .htaccess or any other type of server side redirects. Apache tries to do it on their site but there's no stock answer to every question. There are simply too many configurations out there and too many variables that can be thrown into the mix.

That said, you're right. mod_rewrite with a decent knowledge of REGEX is da' bomb.

#291 saetveit

saetveit

    HR 1

  • Members
  • Pip
  • 2 posts

Posted 22 November 2006 - 10:29 AM

I know this is an old post, but I'm hoping there is someone with a solution to a problem I'm having with it!

I'm having a little trouble getting this to work properly. I'm using a *nix server with mod_rewrite enabled.

I'm using the following syntax in my .htaccess file:

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


This works great for the home page. I.e.,

mydomain.org redirects to www.mydomain.org .

However, when I'm on another page of my website, it does not redirect properly.

For example, if go to:

mydomain.org/testdirectory/abcdefg.html

I am redirected to:

www.mydomain.org/index.php/abcdefg.html

Can anyone give me a hint about where my configuration is flawed that would cause this problem?

Thanks!

UPDATE: I've tested and it only happens to URL's in my CMS. I'm using Joomla! 1.0.11 with ArtioSEF. It looks like I'll have to solve the problem through the CMS...

Edited by saetveit, 22 November 2006 - 11:09 AM.


#292 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 23 November 2006 - 06:28 AM

Welcome saetveit ! hi.gif

hmm... Somewhere in Joomla's code they must be hardcoding the index.php call. That could be in their base .htaccess or could be in the configuration file for Joomla too.

Sorry, but I have no clue where to start looking on that one. I did however find a post on their forum that may get you started. Towards the bottom someone references another post they used to sort out the old www/non-www issue, and what they added. Apparently it worked.

#293 saetveit

saetveit

    HR 1

  • Members
  • Pip
  • 2 posts

Posted 23 November 2006 - 11:11 AM

Got it! When you mentioned that index.php must have been hard-coded somewhere (which I knew, but hadn't quite synthesized...), I checked the .htaccess file more carefully. Sure enough, in the 3rd party SEF extension rewrite section, there was a line:

RewriteRule (.*) index.php

When I commented it out, my SEF URL's didn't work. However, if left that line as is and moved the 301 redirect code BEFORE this line, everything works like a charm! Thanks for the hint!

#294 ABK

ABK

    HR 2

  • Active Members
  • PipPip
  • 33 posts

Posted 12 December 2006 - 08:15 AM

Hello,
I am new on this foum so please help me with some answers.
I have a website that is hosted in the US. I HAVE to move it to Germany so the IP will change. The domain name and the website (which is a .com) will remain the same.
This IP change can affect my website's PR and can also make my site fall in the SE's in one word to have disadvantages?
Also my target customers are in the US. I know that ranking in SE's may differ between data centers. In order not to drop down for the datacenters in the US what is the best approach? I was thinking to have a 301 redirect from the old IP in the US to the new IP in Germany?
I am pretty new with SEO so hope that my post makes sense.
Thanks.

#295 chrishirst

chrishirst

    A not so moderate moderator.

  • Moderator
  • 7,112 posts
  • Location:Blackpool UK

Posted 12 December 2006 - 09:00 AM

welcome to HR hi.gif

PR will not change (not that it make a difference if it did)

You can't 301 from a IP that will not be hosting the site, DNS will take care of that, just leave the site on the old IP for a few days (a week at the most) just to make sure that the new DNS has propogated.
If you have any control over the DNS server (or your host is useful) change the TTL to 15 minutes about a week before before you move over.

Providing the move has no hiccups, nothing should be disastrously affected (in theory) though your rankings on German SEs may improve.

Best of luck with the hosting co you are probably moving to.

#296 ABK

ABK

    HR 2

  • Active Members
  • PipPip
  • 33 posts

Posted 13 December 2006 - 03:24 AM

Thank you for your information chrishirst.
Can you tell me what TTL stands for?

#297 MaKa

MaKa

    HR 6

  • Active Members
  • PipPipPipPipPipPip
  • 856 posts
  • Location:Llantwit Major, Wales, UK

Posted 13 December 2006 - 04:22 AM

QUOTE
TTL (Time To Live)

All DNS records have a TTL property, specifying the amount of time other DNS servers and applications are allowed to cache the record.

Source: www.simpledns.com/help/index.html?df_ttl.htm

#298 davidl

davidl

    HR 1

  • Members
  • Pip
  • 5 posts

Posted 13 December 2006 - 06:06 PM

Hello All, I am a new user with this forum, but have been reading posts for awhile to help with my website.

I just recently purchased a domain name from someone that ranked pretty high in google. I am creating my own pages that are much different than the pages that the old owner had. However, I am trying to rank high on the same keyword that he was even though his business/field is totally different than mine. I was thinking about putting in a 301 redirect in the .htaccess file in order to direct all non www entries to www, but I didn't want to do anything to affect the site's current ranking in google. I guess once google crawls the site again and recognizes that is has totally changed, it will affect the website's ranking, but I just want to make sure they don't stop crawling my site if I put in a 301 redirect, especially when I am not sure that I need one anyway.

Thanks.

#299 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 14 December 2006 - 07:26 AM

Welcome David ! hi.gif

Redirecting the non-www to the www address won't cause the spiders to stop crawling, so no worries there. The opposite is also the case.

Here's what you'll want to do to see if it's a problem and which way to point the redirection. First go to each of the major search engines (Google, Yahoo!, MSN, Ask) and type in site: thedomain.com This will give you a list of pages that have been indexed by each search engine. Pay particular attention to the address they show there, specifically whether they have it as the www address, without the www address or pages with both versions.

If you have one or the other, that's the way you'll want to set up your redirect most likely since the engines already know those pages exist and have them indexed.

If you see some of both, you'll need to go a bit farther to see which version ranks best. Again go to the search engines and type in some keywords that pull up the site. Or you can use keywords in a normal search in combination with the site: command. See which version ranks the best. This will probably be the way you want to point your redirection.

Make sense?

#300 davidl

davidl

    HR 1

  • Members
  • Pip
  • 5 posts

Posted 14 December 2006 - 04:20 PM

great, thanks Randy, that makes sense. It looks like I need to redirect non-www to www. The code below is what I need to put in the .htaccess file, correct? Obviously, replacing yoursite with my website name.

CODE
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yoursite.com [NC]
RewriteRule ^(.*)$ http://www.yoursite.com/$1 [L,R=301]

Edited by Randy, 14 December 2006 - 05:08 PM.
Added code tag





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users

SPAM FREE FORUM!
 
If you are just registering to spam,
don't bother. You will be wasting your
time as your spam will never see the
light of day!