Plugin to manually write category and/or album urls? Plugin to manually write category and/or album urls?
 

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

Plugin to manually write category and/or album urls?

Started by Walkinman, December 30, 2013, 08:12:30 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Walkinman

Hi folks

I posted this in the feature requests, and it was suggested to post for a plugin instead. So here goes.

I don't see where this has been posted before as a specific request .. but would it be possible? I'm using the plugin for SEO friendly urls (for the time being) and not sure if that would create a conflict. But I would like to be able to write custom permalink urls for at least categories and albums, and possibly even image display pages as well.

So rather than have an automated setup, like the plugin tries to do, have a field that allows me to write a custom permalink. Wordpress does this easily, and if I write a permalink already being used, it simply adds a "-2" to the end of the new one, etc, to avoid conflicts.

I'm beginning (slowly) to understand how cpg works a little differently, so it may not be possible without major overhaul for the image display pages, in fact, for search results it may not even be necessary .. but the album and categories should be straight forward, no?

Thanks in advance.

Cheers

Carl

gmc

If looking at categories and albums only (a much smaller quantity) - and manually writing them - does this need to be a plugin IN Coppermine?  My ISP's CPanel provides a 'Redirect URL' function I use to provide alternate links to select categories (and no reason it wouldn't't work at the album level...
EVEN WITHOUT CPanel support - it is just an update to .htaccess to set the redirect...

In my case I currently have multiple galleries in different subdomains - and wanted simpler and static url's to provide as links.

Galleries include:
gallery.gmcdesign.com
greggallery.gmcdesign.com
bkgallery.gmcdesign.com
skygallery.gmcdesign.com

I decided to use www.gmcdesign.com/gallery as a base for the redirect URLs.
Some examples from the .htaccess file:
Gallery redirect:

RedirectMatch "^/gallery/?$" "http://gallery.gmcdesign.com"
RedirectMatch "^/gallery/greg/?$" "http://greggallery.gmcdesign.com"
RedirectMatch "^/gallery/bilk/?$" "http://bkgallery.gmcdesign.com"
RedirectMatch "^/gallery/skymasters/?$" "http://skygallery.gmcdesign.com"

Category Redirect:

Redirect "/gallery/rcflying/" "http://greggallery.gmcdesign.com/index.php?cat=7"
Redirect "gallery/lodragons/" "http://greggallery.gmcdesign.com/index.php?cat=13"
Redirect "/gallery/midam/" "http://greggallery.gmcdesign.com/index.php?cat=8"

So entering or clicking on:
http://www.gmcdesign.com/gallery/bilk/ will redirect to the bkgallery.
http://www.gmcdesign.com/gallery/rcflying/ will redirect to the rc flying category in greggallery.

As I recall, the CPanel interface required I create an empty folder at the 'source ' location of the redirect to select it - don't know if this would be required otherwise...

Does this do what you are looking for without having a CPG plugin?
Otherwise what additional/different are you looking for?
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

Walkinman

Hey Greg

It might be a conflict with the plugin or something perhaps, but when I try adding a rewrite rule in the htaccess file, it doesn't work. I tried a few, including adding it directly from cpanel. This below looks like it should work, but doesn't seem to

RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^stock/index\-3\.html$ http://www.example.com/stock/wildlife-photos/ [R=301,L]


That's in the root directory htaccess file .. I tried it as /index-3\html as well. I added a folder under 'stock' called 'wildlife-photos' .. i even tried adding the htaccess line in the "stock" directory, and modified it to fit accordingly, but nothing works.

I tried a simple Redirect 301 line in the root directory .. but it says nothing is sound .. and when I do that, it always adds a "?cat=3" after the rewritten url, in the url .. so http://www.example.com/stock/wildlife-photos/ becomes http://www.example.com/stock/wildlife-photos/?cat=3

Actually, I think (I don't TOTALLY understand, but I think) what you're doing is the opposite. You can provide a clean link via email or in your navigation bar even, that redirects to the dynamic url when visited. What I want is a rewrite, that rewrites something like

example.com/gallery/index.php?cat=3

to something like

example.com/gallery/plane-photos/

So the actual url in the url bar at the top of the browser is the 2nd one. This is what the plugin does for images and for albums .. not for categories .. and it doesn't allow me to manually write one at all. Which would be ideal. Even better would be a setup where any of the images then linked from that category or album, for example, would be in the next directory

example.com/plane-photos/002-image.html

or

example.com/plane-photos/B52s/001-image.html

and so on.

I would've thought something simple like


RewriteRule ^(.*)/index-3\.html$ http://www.example.com/stock/wildlife-photos/ [R=301,L]


in either the root directory OR the the 'stock' directory (losing the word 'stock' after rewrite rule) should work, but it doesn't. This COULD be because of a possible conflict with the plugin? Maybe?

Note - the above line
RewriteRule ^(.*)/index-3\.html$ http://www.example.com/stock/wildlife-photos/ [R=301,L]

is close .. it redirects, but it doesn't find a page at that url. Same thing if I make the redirected url ../wildlife-photos.html it produces a 404.

A plugin, or a hack in CPG that simple allows you to go to the CPG admin, go to Category Properties, or Album Properties, and rewrite the url there would be best and simplest.

NB: I know some of the people who used to frequent these forums (including developers) repeatedly claimed that CPG works 'as is' for SEO, but there's no question at all that having some keywords in the url helps SEP. It doesn't work to stack the url with lots of them, and the deeper they are in the directory structure, the less juice they retain .. but it's definitely the case that a simple, well phrased url helps gain better SEP.

gmc

Quote from: Walkinman on January 02, 2014, 05:30:50 AM
...
Actually, I think (I don't TOTALLY understand, but I think) what you're doing is the opposite. You can provide a clean link via email or in your navigation bar even, that redirects to the dynamic url when visited.
...
You are correct - I am doing the opposite - The clean link to use in getting to the site, that redirects to dynamic url when visited...
Quote
...
What I want is a rewrite, that rewrites something like
example.com/gallery/index.php?cat=3
to something like
example.com/gallery/plane-photos/
So the actual url in the url bar at the top of the browser is the 2nd one. This is what the plugin does for images and for albums .. not for categories ..
OK - that will need more than just .htaccess - the rewrite should be able to convert the url as you want - BUT - then Coppermine will need some code to be able to translate back to the correct category, album, picture, etc... by default it won't have a clue (the reason for the 404 you are seeing)

Will give it some thought...
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money