Trying to leave coppermine and want to redirect old CPG urls to new site Trying to leave coppermine and want to redirect old CPG urls to new site
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Trying to leave coppermine and want to redirect old CPG urls to new site

Started by Walkinman, January 20, 2023, 02:48:33 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Walkinman

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

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

RewriteRule ^stock/thumbnails\.php\?album=36$ https://www.domain.com/gallery/appalachian-trail-photos/ [R=301,L]

Does nothing. I also tried it as

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

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.

Walkinman

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
RewriteCond %{QUERY_STRING} (^|&)cat=51(&|$)
RewriteRule ^/(.*)\.php$ - [G]

Above is how to 401 a category from a CPG install


Item #2
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
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
RewriteCond %{QUERY_STRING} (^|&)album=40(&|$)
RewriteRule ^cpg/(.*)\.php$ - [G]

Above is how to 401 an album from a cpg install

Item #6
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
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