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

#271 MichaelM

MichaelM

    HR 4

  • Active Members
  • PipPipPipPip
  • 109 posts
  • Location:Belfast, Northern Ireland

Posted 03 August 2006 - 07:58 AM

Ive just tried this code "Redirect 301 /index.html http://subdomain.domain.com"

But it didnt work on Firefox sad.gif

Is what I want possible?

EDIT - Sorry. I didnt realise I was double posting! sad.gif

#272 plarson

plarson

    HR 1

  • Members
  • Pip
  • 1 posts

Posted 16 August 2006 - 10:41 AM

Hi, I'm new to this forum and need some help with a 301 redirect.
We have purchased www.newdomain.com and have had our hosting company transfer our old domain site to our new domain name site. I now need to do a 301 redirect but have no prior experience or idea on how to do this. The hosting company runs linux and does support .htaccess. There has been may new pages added to the new site as well as content and images, pretty much we have redone the site and moved many pages to other sites.
We have many aliases as well under this domain, that will eventually be new sites for some of our products and eventually link back to our main site.
I have been told by the person that build the original site to use 301 redirects on all file names and point to the a new name using spredsheet.

Please help me, plarson

#273 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 16 August 2006 - 03:18 PM

Welcome plarson ! hi.gif

You'll probably want to use a 302 instead of a 301 for the domain transfer portion of your question. See our [url=http://www.highrankings.com/forum/index.php?showtopic=12535]aging delay thread[/url] for the reasons why you'll probably want to do this with respect to Google.

Other than that, we'll need a few more details.

Did the current filenames of the old domain remain consistent for the new domain? Or did these change too? If they remained consistent you may be able to come up with just a couple of rules to do all that you want to do. If they changed, you're going to be looking at individual redirects for each of the old pages over to each of the new pages.

#274 DaYFlaMe

DaYFlaMe

    HR 1

  • Members
  • Pip
  • 4 posts

Posted 30 September 2006 - 09:25 PM

Hi @All: I did a mod rewrite in my .htaccess file a while back to take care of the same problem. Here's what mine looks like... Can anyone please let me know if these are correct, as far as the SE's are concerned please?

Randy I have use your code... after test with WebBug become i this result?!

The results of checking:

result with Radio Button 1.0
CODE
HTTP/1.1 302 Found
Date: Sun, 01 Oct 2006 01:26:29 GMT
Server: Apache/2.0.48 (Linux/SuSE)
X-Powered-By: PHP/5.0.4
Location: ./user/index.php
Connection: close
Content-Type: text/html


result withRadio Button 1.1
CODE
HTTP/1.1 200 OK
Date: Sun, 01 Oct 2006 01:29:08 GMT
Server: Apache/2.0.48 (Linux/SuSE)
X-Powered-By: PHP/5.0.4
Connection: close
Content-Type: text/html



Here is my Mod Rewrite Code:

CODE
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.domain\.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L]
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(([^/]+/)*)index\.html\ HTTP/
RewriteRule index\.html$ http://www.domain.com/%1 [R=301,L]


Also with this and many other variant I get 302 indicated sad.gif

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


please a helping?

#275 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 02 October 2006 - 08:29 AM

Welcome DaYFlaMe ! hi.gif

What exactly are you trying to cure? Canonical issues I would guess?

PM me over the details --your site address, what you're trying to address, a copy of your current .htaccess, etc-- and I'll be happy to take a look.

FWIW, you'll want to always use HTTP 1.1 when checking via WebBug. 1.0 was buggy as buggy can get.

#276 DaYFlaMe

DaYFlaMe

    HR 1

  • Members
  • Pip
  • 4 posts

Posted 06 October 2006 - 09:42 PM

Hi cheers.gif

I have three multi tld domains see example please:

www.example.it
www.example.com
www.example.tr

I would like to pass all this on my domains redirect to (.com) with Mod REWRITE.
Thus if someone example.it into the address field or enters example.tr, he/they is to be passed on to www.example.com/
Sorry my bad English embarrassed.gif

can you help me please?
greeting

Edited by Jill, 07 October 2006 - 12:59 AM.


#277 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 07 October 2006 - 08:24 AM

If each of the domains is set up with separate hosting, meaning you have to upload all of the files to each location, you could put the following in an .htaccess file for each of the sites you want to be redirected.

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


If the extra domains are parked on top of the .com domain, meaning you only upload the files to a single location but all three domain names feature the same files when you surf them, you could put the following in the .htaccess file of this main .com location.

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


The above assumes you're on a *nix server running Apache and that the mod_rewrite module is enabled.

#278 DaYFlaMe

DaYFlaMe

    HR 1

  • Members
  • Pip
  • 4 posts

Posted 07 October 2006 - 11:41 AM

hi Randy,
all 3 domains is on the same server! means it, which I must use for each the domains, following code like that here:

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


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


pass on as follows and then oh on com domain?

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


Excuse please, but I have genuinly no notion of it search.gif

#279 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 08 October 2006 - 07:14 AM

It's not so much if they're on the same server, but whether the domains are all stand-alone entities or if they're being parked/aliased DaYFlaMe.

The easiest way to tell which it is is by what happens when you upload a new page. If you upload each new page a single time to a single location, but the new page magically shows up on all domains, you're using parking/aliasing. In which case you should be able to set it all straight using just the 3rd example from above.

If they're stand-alone entities --meaning you have to upload each new page 3 times to each domain-- then you'll need to use the 1st and 2nd examples from your post above on each of those extra domains as appropriate.

#280 DaYFlaMe

DaYFlaMe

    HR 1

  • Members
  • Pip
  • 4 posts

Posted 08 October 2006 - 01:19 PM

Randy i have all 3 Domains upload in same location (directory).
The following domains are on the same server and in the same file (location).
It concerns only, if someone which enters the ending (.it) in address field, one passes on (.com)

I will redirect
example.tr
example.it

to

example.com

Can you provide me please a solution. I could do it unfortunately not to run sad.gif
thanks for yours strive

#281 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 09 October 2006 - 06:59 AM

Sounds like the domains are parked/aliased.

Assuming you're on a Unix/Linux system and assuming mod_rewrite has been enabled, the follow should do the trick.

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


If that doesn't work you'll need to get in touch with your server support folks to see what they have to say.

#282 gburks

gburks

    HR 1

  • Members
  • Pip
  • 3 posts

Posted 16 November 2006 - 08:53 PM

Hi,
I used your example above for a similar situation (need domain.net, domain.org, and domain.com to redirect to www.domain.com).

When you hit domain.com, it properly redirects to www.domain.com. However, when you hit any of the other TLD's, such as domain.net, a double slash gets added to the end. Like this:

domain.net redirects to
www.domain.com//

and domain.net/index.html redirects to:
www.domain.com//index.html

How can I prevent these double slashes?

Thanks,
Graham

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


#283 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 16 November 2006 - 09:27 PM

Welcome Graham ! hi.gif

It sounds like your server is automatically adding the trailing slash in there before anything else happens.

This is (severely) untested, but worth a try.

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


Be prepared to change it back quickly though because it may produce an internal server error. I've never tested it on a system similar to yours so anything is possible.

If it doesn't work you may require using a couple of different RewriteCond's to separate out the same domain from parked domains issue.

#284 gburks

gburks

    HR 1

  • Members
  • Pip
  • 3 posts

Posted 16 November 2006 - 09:43 PM

Thanks for the quick reply Randy, but that didn't do it.

I tried something similar to your earlier example, placing multiple rules in a row for each redirect. Same results with a double slash, although I think this may be more along the lines of what I want to do.

Can you think of specific rewrite rules that would strip off the additional slash after the .com (turning ".com//" into ".com/") for just the parked domains?

#285 Randy

Randy

    Convert Me!

  • Moderator
  • 17,540 posts

Posted 17 November 2006 - 06:44 AM

I can give it a shot. wink.gif

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


The idea beign that the first RewriteCond/RewriteRule will only fire when a request comes in for your main domain without the www subdomain, so will take care of all of those first and foremost. When it happens this rule will fire to get the www in there and stop.

Then the second RewriteCond/RewriteRule will look for requests that come in with other domains in the query, with or without a www and send them over to the www.maindomain.com address, without a trailing slash.

It's still a bit of a crapshoot since we don't know where in the process the server is adding the extra trailing slash. But since we're letting it add the slash in there as part of the $1 variable for those redirects only one should appear.




0 user(s) are reading this topic

0 members, 0 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!