forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: Walkinman on January 20, 2023, 02:48:33 am

Title: Trying to leave coppermine and want to redirect old CPG urls to new site
Post by: Walkinman on January 20, 2023, 02:48:33 am
I'm switching to a new server, and now using cpg, and having trouble getting redirects to work.

For albums and categories that will not redirect, just are gone and no longer exist, I wrote the 410 rule as

Code: [Select]
RewriteRule ^stock/thumbnails\.php\?album=62$ - [R=410, L]
That breaks the new site and creates a 500 error

For abums I want to redirect to a new url, I wrote

Code: [Select]
RewriteRule ^stock/thumbnails\.php\?album=36$ https://www.domain.com/gallery/appalachian-trail-photos/ [R=301,L]
Does nothing. I also tried it as

Code: [Select]
Redirect 301 /stock/index.php?cat=2 https://www.domain.com/gallery/outdoor-recreation-photos/
which also does nothing.

I also want to redirect any image display pages to the root gallery of their relative album. So an image from a particular cpg album would go to the gallery page for that on the new site. I wrote

Code: [Select]
RewriteRule ^stock/displayimage\.php\?album=30&.*$ https://www.domain.com/gallery/canadian-wildlife-photos/ [R=301,L]
RewriteRule ^stock/displayimage\.php\?album=32&.*$ - [R=410,L]

to send any image from album 30 to the CA wildlife photos album and any image from album 32 is gone.

None of these last work but I can't see what's wrong with them?

Any help would be superduper appreciated, thanks.
Title: Re: Trying to leave coppermine and want to redirect old CPG urls to new site
Post by: Walkinman on July 21, 2023, 02:20:36 am
So here is some info for you if anybody is ever looking for it. Somebody helped me out so I thought I'd pass on the good karma.

Item #1
Code: [Select]
RewriteCond %{QUERY_STRING} (^|&)cat=51(&|$)
RewriteRule ^/(.*)\.php$ - [G]
Above is how to 401 a category from a CPG install


Item #2
Code: [Select]
RewriteCond %{QUERY_STRING} (^|&)album=89(&|$)
RewriteRule ^cpg/(.*)\.php$ http://newdomain.com/gallery/gallery-name/
Above is how to redirect an album from a cpg install to a new domain and directory


item #3 and 4
Code: [Select]
RewriteRule ^cpg/displayimage(.*)\.html$ - [G]
RewriteRule ^cpg/displayimage(.*) - [G]
Above is If you used the (hopefully long-deprecated SEO friendly url plugin _ hell, don't recommend it)
how to 401 an image page

Item #5
Code: [Select]
RewriteCond %{QUERY_STRING} (^|&)album=40(&|$)
RewriteRule ^cpg/(.*)\.php$ - [G]
Above is how to 401 an album from a cpg install

Item #6
Code: [Select]
RewriteRule ^cpg/displayimage\.php?album=2&.*$ https://newdomain.com/gallery/gallery-name/ [R=301,L]Above is how to 301 redirect an image from an album in an old CPG install to a new domain.

Hopefully that is helpful to anybody having trouble. Here's a link to the awesome assistance I got from Stackoverflow
Code: [Select]
https://stackoverflow.com/questions/75203830/having-trouble-with-some-redirect-rewrite-codes-301-and-410s
My time with CPG is done. Wish you all the best with your project.

Cheers
Carl