301 redirect

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
rj
Regular
Posts: 477
Joined: Sun Sep 10, 2006 2:53 pm

301 redirect

Post by rj »

I have a website with a couple thousand pageloads a week and a google rank of 5.

I have the blog on the same server in a directory and now want to move the blog to the domain name and have the traffic and the rank go to the blog rather than the website.
Some say do 301 redirect. (I have the code for this)
Some say just move your blog index.php into the root.
Some say erase the existing WWW.domain redirect, leave THAT as the website and use the NO-WWW.domain for the blog?

Any advice on this please?

RJ
rj
Regular
Posts: 477
Joined: Sun Sep 10, 2006 2:53 pm

Post by rj »

Hey Me! :)

I tested the .htacess 301 and it worked fine, except it created about 1000 bad links and graphics! :)
Any way out of that problem I wonder? Other than moving my root files into the serendipity directory?

So I thought I would see what a php redirect does. I get this code from everywhere, and it says put at the tippity top of the index.htm page which I do and nothing happens.

<?php
header( 'Location: http://rackjite.com/serendipity/index.php' ) ;
?>

RJ
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Take care that if you move your s9y directory from its directory to the root that all links that currently refer to your blog will no longer have a valid link and will decrease your pagerank effectively.

So the only proper way would be to add a redirect from your "/" and "/index.html" (or whatever your files is) files to the blog using a 301 redirect.

Using mod_Rewrite and .htaccess this would be:

Code: Select all

RewriteEngine On
RewriteRule ^/$ http://rackjite.com/serendipity/index.php [L,QSA]
RewriteRule ^/index.html http://rackjite.com/serendipity/index.php [L,QSA]
This would leave your old graphics intact.

The PHP snippet you have there will only work if your index.htm file is parsed by PHP. Usually only .php files are parsed by PHP, so you need to ask your webserver admin if they can also PHP-parse .htm files. This however will make your .htm files a bit slower as well as maybe introducing parse errors depending if your .htm files are valid PHP syntax.

Go with mod_Rewrite as indicated above, if you have mod_rewrite available.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
rj
Regular
Posts: 477
Joined: Sun Sep 10, 2006 2:53 pm

Post by rj »

I will try that out after my nappy! :)

Now that I know more about this let me explain again.

my domain, rackjite.com/ has a google rank of 5, but sometimes 6, so I figure its about 5.8. :)

My serendipity blog /serendipity has a google rank of 4, but sometimes 3, so I figure its 4.1.

I want all external links to arrive at the blog carrying over the 5.8.
Front and center of the blog header is big purple graphic link GO TO MY WEBSITE. The website is still important to many people.

So does this new process of yours carry the domain page rank over?
Because I know if I arrive at the webpage by typing in rackjite.com/index.htm, its 0 rather than 5.
rj
Regular
Posts: 477
Joined: Sun Sep 10, 2006 2:53 pm

Post by rj »

"The server encountered an internal error or misconfiguration and was unable to complete your request."
My server Godaddy says that php5 is installed and running.

I also noticed the standard code I have that works redirects to the blog okay, and even carried over the page rank (for a while) but I couldn't figure out how to get to the website. When I would type in rackjite.com/index.htm, or any of the other 50 pages, the address automatically changes everything to rackjite/serendipity/ which makes a mess. :)

I need a better understanding what is going on I guess.
Lots of graphics and internal links are bad, but I can fix that by hand in a day or two.

Let me ask this one again...
Forget the 301

If I were to move the contents of serendipity/ into the domain root, what would happen? :)


RJ
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Sadl ythis kind of SEO is above my knowledge and it has no importance to me, so I'm afraid I can't help you further on this topic.
If I were to move the contents of serendipity/ into the domain root, what would happen? :)
All of your current .html files on your domain root would cease to be callable, because the directory that s9y is in takes all links and converts them to the s9y framework, thus rendering "really existing" files unaccessible. This is to support custom permalinks. You can only bypass that my manually modifying .htaccess rules or disabling URL Rewriting in s9y.

As to the regards of pagerank - I don't know what would happen. :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

When I migrated my site, I added permalinks to the articles to make them work as Google and my existing visitors expected. I also added lines to my .htaccess so pictures and other links would work as before. The whole move was transparent to Google, as far as I could tell (I didn't have the kinds of tools we have now, and I've never had the rank you do).

I've never tried the 301 thing. I understand that Google respects it, but I have no experience with it.

Sorry we can't be more helpful.
Judebert
---
Website | Wishlist | PayPal
rj
Regular
Posts: 477
Joined: Sun Sep 10, 2006 2:53 pm

Post by rj »

Well I think I may do what I gather you did rather than the 301. Perhaps 301 for some link issues.

Take everything in /serendipy/ and move it to the root. then take all the website stuff in the root now and move it to /website/. Then by hand just take the time to change all the links. A day or two of work, but once I have done it thats the end of it! I have to do something with graphics anyway, I have years of graphics in the root mixed up with everything else and they need to go into a directory anyway.

I am waiting on Garvin for a reply to this. I think the code he gave me is not about a 301 as it sits, but some 301 to use IF I decide to move serendipity into the root and help save my links...

I just am not clear on that.

Hey, things are starting to pop before I am ready! DIgg and Reddit are liking me. Such a problem hey? Traffic before I am ready for it! :)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

If you move all stuff out of your current / and to /website/ you will loose your pagerink on / because all those URLs will then no longer be valid. So you'd need to add redirection from the old stuff / to /website/. That however in turn most likely will not put the same pagerank to the blog at / because it's different content.

Whatever you do, I don't think there's a solution that will give you the pagerank you have on / now to contents of /serendipity/. Whatever you do most likely will affect pagerank, and I can't tell if it will be a good or bad affection. That, only SEO people can tell for sure. :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
rj
Regular
Posts: 477
Joined: Sun Sep 10, 2006 2:53 pm

Post by rj »

Right now, 98% of the links out there are to the website, not the blog.
So at this point, links to the blog do not seem important to me.
I thought google page rank was dependent only upon the DOMAIN NAME.
So for the immediate future anything behind the domain would carry the page rank. Could change down the line, and as you say, who knows which way it will go. :)

My immediate problem is no matter a 301 in .htaccess or even a meta redirect, I cannot figure out how to get to the webpage anymore. If I change a link or type in the address bar "rackjite.com/index.htm", it rewrites it and adds serendipity/ and forces the blog.

Once I understand this part I think I can get a grip on all this! :)

My wonderful problem at the moment is traffic is coming in faster than I am ready for and I have to move on this soon...
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

No, Googles PageRank is calculated through the list of incoming links you receive.

If all incoming links point to yourdomain/blar.html, the pagerank for "yourdomain" will get pretty high. If all links point to yourdomain/blog/blar.html, the higest page rank will be put to "yourdomain/blog/".

You might need to google for 'pagerank' to see some more specific information. It's all guesswork though, because google does not disclose how they calculate pagerank.
My immediate problem is no matter a 301 in .htaccess or even a meta redirect, I cannot figure out how to get to the webpage anymore. If I change a link or type in the address bar "rackjite.com/index.htm", it rewrites it and adds serendipity/ and forces the blog.
That's right, that's what I mentioned earlier. You must put your old root contents into a seperate directory and put a .htaccess file with "RewriteEngine Off" into that directory. Or you need to turn of Serendipity URL Rewriting to allow files in your root directory to be callable.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
rj
Regular
Posts: 477
Joined: Sun Sep 10, 2006 2:53 pm

Post by rj »

Thanx for the reply
I am very slowly coming to grips with this. :)
Here is the 301 section of my htaccess file:

#my www redirect
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^rackjite\.com
RewriteRule (.*) http://rackjite.com/$1 [R=301,L]

#working 301 to /serendipity
#RewriteEngine on
#RewriteCond %{HTTP_HOST} ^rackjite\.com
#RewriteRule ^(.*)$ http://rackjite.com/serendipity/$1 [R=permanent,L]

#garvins 301 fix
#RewriteEngine On
#RewriteRule ^/$ http://rackjite.com/serendipity/index.php
#[L,QSA]
#RewriteRule ^/index.htm
#http://rackjite.com/serendipity/index.php [L,QSA]

So... I make a new directory off the root called /website.
I put all my website files in it.

Then I turn on the WORKING 301 to Serendipity.

I remove GAVINS 301 fix from that htaccess file, create a new htaccess file, add GARVINS FIX to it and put it in the new /website directory.

Just to make sure...
Could you put in the hard URL
rather than the relative URL into GARVINS FIX using my new directory /website. Please... :)

I am sorry I need such specific instructions, please bear with me.
In the past 2 months I have had to get a working knowledge to at least understand, edit and apply CSS, SSI, FLASH, Javascript, Dreamwearver, Flash 8, and a bit of internal serendipity code. And now this htaccess code.
Sometimes my brain overflows from too much crap! :)

Thing about this process is I won't have anything in my root anymore!
And I keep hearing how much Google likes the root.

With that in mind, how would I need to change this process if I moved the webfiles into /website and then moved everything below serendiptiy/ into the root. (eliminating the serendipity directory).

I think this is where I am conceptually stuck. I can't decide what to do. :)
I still have less than 100 articles in the blog so I can still change links and graphic links by hand at this point.

Thanx

RJ
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

It all looks pretty good to me. I'm having some conceptual trouble, but...

I think what you're trying to do is 301 redirect all your existing traffic to Serendipity pages. (Because Google will recognize the 301 as indicating that the "new" page is the same as the "old" page, and therefore not change its rank.)

If that's the case, shouldn't you be able to simply put this .htaccess in the root:

Code: Select all

#working 301 to /serendipity
#RewriteEngine on
#RewriteCond %{HTTP_HOST} ^rackjite\.com
#RewriteRule ^rackjite.com(.*)$ http://rackjite.com/serendipity/$1 [R=permanent,L]
So, if your old page is rackjite.com/something.html, Apache will 301 redirect to rackjite.com/serendipity/something.html instead. Now just set up the page with a permalink, so something.html points to a blog page. Poof! Everybody gets to see the new version of the old page, using the old URL, and Google transfers its idea of the page location to the new location.

I think the "Garvin's Fix" code is to redirect your old index.htm to Serendipity's front page. At least, that's what it appears to do to me.

I don't think Google cares so much about the root. (Then again, it's not like my page has a high rank, so what do I know?) Serendipity can run from root, all you need to do is change your paths in the configuration. Of course, then you'd also want to take the /serendipity out of the .htaccess files, and combine the two fixes, so it'd look like this:

Code: Select all

#working 301 to /serendipity
RewriteEngine on
# When we reach the frontpage, we're done.
RewriteRule ^/$ http://rackjite.com/index.php [L,QSA]
# If they want the old frontpage, redirect to the new one
RewriteRule ^/index.htm http://rackjite.com/serendipity/index.php [L,QSA]
# If you set up permalinks for the new versions of the old files, there's
# no need to have a redirect rule; Serendipity will accept the old URLs
# and display the new pages
Please backup before you do anything permanent. I'm not a .htaccess guru; I'm just a programmer. It's been a while since I had to mess with the thing.
Judebert
---
Website | Wishlist | PayPal
gansad
Regular
Posts: 6
Joined: Sun Feb 25, 2007 10:53 am

redirect index.php to index.php?serendipity[subpage]=gallery

Post by gansad »

with .htaccess redirection, how can i redirect entry point to the blog to show index.php?serendipity[subpage]=gallery instead of the standard serendipty index.php front page? I would like the visitors to look at the gallery plugin first and navigate from there.

any suggestion how to do this using .htaccess (or is the a plugin to replace default frontpage?) thanks
rj
Regular
Posts: 477
Joined: Sun Sep 10, 2006 2:53 pm

Post by rj »

Thanx for the reply Judebert!
What I have to do is decide what i want to do! :)
And then get it down to THE specific question to ask.

I am now thinking in terms of making it as simple as possible.
Leave all the directories alone, do the 301 to serendipity I have that works. Fix the few bad paths to graphics and links myself by hand. And then figure out how best to get to the website.

I am going to take a nap and think about THE RIGHT QUESTION. :)
I will probably start it again in a new thread!
Post Reply