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 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.htmlI'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!
Comments
Of course you would have to rename the image filename as well.
But good to know about the html/php choice. Is there any advantage of using php instead of html for suffix?
Thanks for your quick reply - really worried about getting this resolved!
Any reasony why you did rename the images? I am sure there are surely tricks to replace the underscores with dashes in the url via htaccess using regular expressions. Don't have time to dig into that though
I'm just trying to get rid of the extra stuff after the php? part in the new redirected link. Should I be making changes at the end of the zenphoto htaccess file instead of in the root htaccess?
Maybe consult a specific htaccess forum?
As an example, he is advising:
`
RewriteEngine On
RewriteBase /galleries
RewriteRule ^fauna/insects/moths/adults/Luna_Moth_Eyes\.jpg\.html$ http://natureinfocus.com/galleries/fauna/insects/moths/adults/Luna-Moth-Eyes.jpg.php? [R=301,L]
RewriteRule^admin/?$ zp-core/admin.php [R,L] ...
`
My question is, if I make these typs of changes (301 redirects for files that have been renamed or moved) to the htaccess file, do I need to run setup again? I didn't quite understand the instructions in the first few lines of the htaccess file.
Thank you.
But I am not exactly sure what change you are making. From what you have posted it would seem that all you need to do is change the `mod_rewrite suffix` to `.html` from `.php`. have you tried that? In other words it seems the only difference in the links is that the Gellery2 one ends in `.html` and your Zenphoto one currently ends in `.php`. But as I said, you can change that.
Strictly FYI, you may want to check
for the discussion of this at `http://www.webmasterworld.com/apache/4211642.htm`. Go toward bottom of the thread to see their comments about the `RewriteRule^admin/?$ zp-core/admin.php [R,L]` rule.
I will attempt their suggestions for my specific issue when I have a bit more time.