![]() |
|
301 Rewrite role changing folder names and image page exension - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: General support (https://forum.zenphoto.org/forum-4.html) +--- Thread: 301 Rewrite role changing folder names and image page exension (/thread-11635.html) |
301 Rewrite role changing folder names and image page exension - Jole - 2014-02-11 Hello. A friend of mine has changed folder names (not title, but actual folder names) and mod_rewrite suffix from standard ".php" to ".html" For example: http://www.example-site-name.com/my-pets-gallery-suffix/dogs-gallery-suffix/ Now it is without that "-gallery-suffix" and ".html" instead of ".php" like this: http://www.example-site-name.com/my-pets/dogs/ I need help with 301 redirection, I tried this: Image pagesRewriteRule ^-gallery-suffix(.).jpg.php(.)$ $1.jpg.html$2 [L,R=301] Folder pagesRewriteRule ^-gallery-suffix(.*)$ $1 [L,R=301] ` It works great, for first folder level: http://www.example-site-name.com/my-pets/ But, for multi level galleries with sub-folders it just remove last "-gallery-suffix" and I get this: http://www.example-site-name.com/my-pets-gallery-suffix/dogs/ How to remove all instance of "-gallery-suffix" if more than one if URL? Could you please fix my rewrite roles? Best regards. 301 Rewrite role changing folder names and image page exension - acrylian - 2014-02-11 Quote:http://www.example-site-name.com/my-pets/ Sorry, we can't fix your special rewrite rules for you. 301 Rewrite role changing folder names and image page exension - Jole - 2014-02-11 Real folder names were like this: Folder title "Animals", folder name on disk "animals-my-photographs". Sub-folder title "My pets", folder name on disk "my-pets-my-photographs". I do not know why, but user renamed most folder names during creation using same pattern (adding "-my-photographs" at end). Now folder names are renamed and url is cleaner without that "-my-photographs", and everything is working well. I need rewrite rules for .htaccess before any ZenPhoto work to redirect any visitor who wish to access bookmarked page, or to follow link from other sites, and to tell search engines that content is moved to another address. All pages were indexed with old urls (ZenPhoto use urls for categories same as folder names on disk), content is same, just URL is little shorter, without that "-my-photographs", so, old urls are now 404. I hope now you understand why that 301 redirection is needed? 301 Rewrite role changing folder names and image page exension - sbillard - 2014-02-11 This really is not the forum for your question on rewrite rules. Probably you should start here http://httpd.apache.org/docs/2.0/misc/rewriteguide.html 301 Rewrite role changing folder names and image page exension - acrylian - 2014-02-11 Ok, now I get it. The non rewrite link of an album is I fear this will not be easy as the actual rewriting is handled internally with Zenphoto now and not via htaccess directly. Maybe my collegue has any idea, I am really no htacess wizard for such specific things (it is not directly a ZP issue technically). 301 Rewrite role changing folder names and image page exension - Jole - 2014-02-11 Yes, it is not directly a ZP issue technically, ZP is working perfectly, I just need way to tell my server this. If someone wish to open old url: http://www.example-site-name.com/animals-my-photographs/my-pets-my-photographs/ rewrite it to http://www.example-site-name.com/animals/my-pets/ that is now url and ZenPhoto will do rest as usually. I thought that .htaccess rewrite rules (using mod_rewrite module) is the best way for that. I can do it writing this in .htaccess Redirect 301 /http://www.example-site-name.com/animals-my-photographs/my-pets-my-photographs/ http://www.example-site-name.com/animals/my-pets/ ` but for many links it is not practical, rewrite rules are better. And you know many things, so I thought this is something you could know. Just how to remove all instance of "-my-photographs" if more than one in url, hm? |