Question

  • Creator
    Topic
  • #2211361

    301 redirect for dynamic php

    Locked

    by naturalenquirer ·

    I hope someone with rewrite expertise can help me as I don’t know how to do this – I don’t want to lose my existing google index entries!

    I have old gallery2 site with links that were `http://natureinfocus.com/galleries/fauna/insects/moths/adults/Luna_Moth_eye.jpg.html`

    New link for zenphoto gallery should be `http://natureinfocus.com/galleries/fauna/insects/moths/adults/Luna-Moth-eye.jpg.php`

    So I tried adding in root .htaccess file:
    `
    Redirect 301 /galleries/fauna/insects/moths/adults/Luna_Moth_eye.jpg.html http://natureinfocus.com/galleries/fauna/insects/moths/adults/Luna-Moth-eye.jpg.php
    `
    which does at least let Google redirect the link, but now the link displayed on the page is:

    http://natureinfocus.com/galleries/fauna/insects/moths/adults/Luna-Moth-eye.jpg.php?album=fauna/insects/moths/adults/Luna_Moth_eye.jpg.html

    I’m thinking I should be using Rewrite Rule, but I don’t have the knowledge on know how to write the rule – I’ve made some attempts but can’t get it to work.

    I’m asuming I should put the .htaccess in the root and not the zenphoto directory?

    Could someone please give me an example for this file? Then I think I can fix the oher links.

    I’m really struggling with this!

All Answers

  • Author
    Replies
    • #2864066

      Clarifications

      by naturalenquirer ·

      In reply to 301 redirect for dynamic php

      Clarifications

    • #2863975

      Nice site.

      by seanferd ·

      In reply to 301 redirect for dynamic php

      OK, I don’t know about PHP, butif this is your site, why would you want Google to redirect?

      As you see now, it is throwing a 404, which is likely why it is defaulting back to the general gallery.

      The 301 should be local, and not involving Google. I take it the redirect is supposed to search for the file name, via Google site search, and find the file, then produce the link. I would suggest simply fixing the links, or keep the redirect internal.

      The actual redirect link does work, it just shows the redirect. But the old site is throwing a 404 instead of doing the redirect. And it doesn’t really matter (I think) whether it says .html or .php at the end. Either works, but the redirect is not.

      You may need to adjust the behavior of the 404.

Viewing 1 reply thread