forum.coppermine-gallery.net

No Support => Modifications/Add-Ons/Hacks => Mods: Searching => Topic started by: rbl on October 27, 2003, 06:30:11 am

Title: mod_rewrite crash course: what and how
Post by: rbl on October 27, 2003, 06:30:11 am
Note: I tried to post this hack in the hacks/mods forum but it's moderators only. Please move it if appropriate. Thanks!

In the last few hours I've been busy turning all my site URLs from this:
http://lomoblog.com/displayimage.php?album=17&pos=27
into this
http://lomoblog.com/album/17/img/27
I've made all my public urls search engine friendly and also more human readable and understandable.
All admin urls were left untouched because there's really no need to mess with those.

So before I proceed, a disclaimer:
 - I'm no mod_rewrite whiz. I have google and a lot of patience.
 - I'm not a php programmer.  I can read, I have google and a lot of patience.
 - This solution fits my needs. If it fits yours, good. If not, you shouldn't try this, since I'm unable to help.
 - If you are not comfortable messing with code, do not try to apply this.
 - If you have any suggestions, don't be shy!

CPG has a nice feature that saves a lot of sweat to any webmaster: it resides inside its own dir and hasn't any link dependancies outside, e.g., all links point to cpg directory.
Making friendly urls breaks this and forces you to recode/re-link a lot of files/links even though not a single file will be moved from its current location.

My CPG installation resides in my site's root which helps me a lot: adding a single forward slash in the beginning of each link solves most of my problems.

I've changed 5 files to make this work on my site. Since my CPG is already heavily hacked, I can't guarantee it will not need another tweak somewhere else.

1 - .htaccess
I've added the following code to my .htaccess
Code: [Select]
RewriteEngine on
#language
RewriteRule ^lang/([a-z0-9]*)/?$   index.php?lang=$1[L]
RewriteRule ^([a-z0-9]*)/([a-z0-9]*)/lang/([a-z0-9]*)/?$   $1/$2&lang=$3 [L]
RewriteRule ^(.+)/(.+)/(.+)/(.+)/lang/([a-z0-9]*)/?$   $1/$2/$3/$4&lang=$5 [L]
RewriteRule ^(.+)/(.+)/(.+)/(.+)/(.+)/(.+)/lang/([a-z0-9]*)/?$   $1/$2/$3/$4/$5/$6&lang=$7 [L]
#RewriteRule ^([0-9a-z]+)?/?([0-9a-z]+)?/?([0-9a-z]+)?/?([0-9a-z]+)/lang/([a-z0-9]*)/?$ $1/$2/$3/$4&lang=$5

#albums
RewriteRule ^album/([a-z0-9]*)/?$  thumbnails.php?album=$1
RewriteRule ^album/([a-z0-9]*)/page/([0-9]*)/?$   thumbnails.php?album=$1&page=$2
RewriteRule ^album/([a-z0-9]*)/sort/([a-z]*)/?$   thumbnails.php?album=$1&sort=$2
RewriteRule ^album/([a-z0-9]*)/page/([0-9]*)/sort/([a-z]*)/?$   thumbnails.php?album=$1&page=$2&sort=$3
RewriteRule ^category/([a-z0-9]*)/?$   index.php?cat=$1
RewriteRule ^album/([a-z0-9]*)/category/([a-z0-9]*)/page/([0-9]*)/?$   thumbnails.php?album=$1&cat=$2&page=$3

#image
RewriteRule ^img/([0-9-]*)/?$   displayimage.php?pos=$1
RewriteRule ^album/([a-z0-9]*)/category/([0-9-]*)/?$   thumbnails.php?album=$1&cat=$2
RewriteRule ^album/([a-z0-9]*)/category/([0-9-]*)/img/([0-9-]*)/?$   displayimage.php?album=$1&cat=$2&pos=$3
RewriteRule ^album/([a-z0-9]*)/img/([0-9-]*)/?$   displayimage.php?album=$1&pos=$2

#search
RewriteRule ^search/([a-zA-Z0-9]*)/?$ thumbnails.php?album=search&search=$1
RewriteRule ^search/([a-zA-Z0-9]*)/?$ thumbnails.php?album=search&type=full&search=$1

2 - template.html
Small modifications. Basically just adding forward slashs to the beginning of SRCs like this one:
<link rel="stylesheet" href="/themes/default/style.css" />
This will ensure that all files have relative paths from the site's root.

3 - index.php
Two small modifications here:
Code: [Select]
$link = $ident . "<a href=\"index.php?cat={$subcat['cid']}\">{$subcat['name']}</a>";for this:
Code: [Select]
$link = $ident . "<a href=\"/category/{$subcat['cid']}\">{$subcat['name']}</a>";and this:
Code: [Select]
$link = $ident . "<a href=\"index.php?cat={$subcat['cid']}\">{$subcat['name']}</a>";for this:
Code: [Select]
$link = $ident . "<a href=\"/category/{$subcat['cid']}\">{$subcat['name']}</a>";
4 - displayimage.php
Lots of modifications here. All a hrefs need a forward slash at the beginning and almost all variables need tweaking.
Example:
Code: [Select]
$thumb_tgt = "thumbnails.php?album=$album$cat_link&page=$page";replaced by:
Code: [Select]
$thumb_tgt = "/album/$album$cat_link/page/$page";$thumb_tgt = "/album/$album$cat_link/page/$page";
and finally, 5 - theme.php
In theme.php it's a bit tricky. Leave alone all a hrefs pointing to variables (example: <a href="{ALB_LINK_TGT}">) and add a forward slash in all  a hrefs pointing to files (example: <a href="/delete.php?...>)
Change all variables like:
Code: [Select]
$cat_l = isset($cat) ? "?cat=$cat" : '';to became:
Code: [Select]
$cat_l = isset($cat) ? "/category/$cat" : '';
I've changed cat with category and pos with img.
To know how to replace urls, use the code above (in .htaccess section) as a guide, example: replace thumbnails.php?album=$album with /album/$album or displayimage.php?album=$album&pos=$id for album/$album/img/$id

I'm sorry this isn't a bit more complete but I'm very tired and wanted to write this while it was fresh on my mind.

Ricardo
Title: mod_rewrite crash course: what and how
Post by: copperminerules on October 29, 2003, 12:47:33 am
has anyone been successful with this hack?

i havnt... but i put that down to lack of php knowledge!
Title: mod_rewrite crash course: what and how
Post by: Joachim Müller on October 29, 2003, 09:08:07 am
possibly it's related to the question: does your webhost allow you to do this magic on his server? Budget webhosting often comes with limitations on these issues. Don't worry - aks your webhost if you're allowed to use the "RewriteEngine".

GauGau
Title: mod_rewrite crash course: what and how
Post by: rbl on October 29, 2003, 12:09:44 pm
One simple way to see if it works is to start with something simple like language or search because you only need to change your .htaccess file and nothing else.
For example, add the following to your .htaccess file:
Code: [Select]
RewriteEngine on
#language
RewriteRule ^lang/([a-z0-9]*)/?$   index.php?lang=$1

and visit your CPG like:
http://your.domain.tld/path_to_coppermine/lang/french
and
http://your.domain.tld/path_to_coppermine/lang/english

You need, of course, to have the language files installed =)

You can try it on my site:
http://lomoblog.com/lang/french
http://lomoblog.com/lang/english
Title: mod_rewrite crash course: what and how
Post by: Oasis on October 29, 2003, 04:54:20 pm
if you try the language rewrite on the last post and it works, your images will most likely be broken, but if the page shows up you will know modrewrite is enabled.
Title: mod_rewrite crash course: what and how
Post by: blueyed on November 13, 2003, 05:06:02 pm
I'd like to see support for mod_rewrite in the release..

There could be sth like
Code: [Select]
$CONFIG['fancy_urls'] = true;
$CONFIG['root_url'] = '/cpg/';

root_url would then be put at front of all paths (like the ones in template.html)..
and fancy_urls would be checked at places where link generation is done.

Or these settings could go to the admin's config part, where there could also be a button 'show mod_rewrite source', which put all necessary lines together.. ready to go into .htaccess.

That would be really sweet..  :)
Title: mod_rewrite crash course: what and how
Post by: gmarik on January 18, 2004, 12:31:43 pm
This one really helped me - this sdould be in the default, standart CPG edition, don't you think so? As an option from the CP.
Title: mod_rewrite crash course: what and how
Post by: Joachim Müller on January 18, 2004, 12:38:23 pm
I don't think so, as it'll only work for users on apache webservers, and we don't want to develop for a single platform. Including options that will only work on certain platforms will confuse most beginners.

I don't want to start a flame thread on this: it's my personal opinion that apache is much better than any other webserver; if you observe my postings from the past  I have the attitude to recommend to people not to use IIS (and not to run their own server if they have no idea what they're doing), but after all it's up to people - they'll have to live with IIS (and for some it's not even an option).

GauGau
Title: mod_rewrite crash course: what and how
Post by: invision on January 24, 2004, 04:26:12 pm
:oops: don't work for me ! :D i got error when use it  :lol:  :cry:  :oops:  :twisted:
Title: mod_rewrite crash course: what and how
Post by: Joachim Müller on January 25, 2004, 08:45:09 am
maybe your host doesn't let you have it. For details, post the error (a link might help as well).

GauGau
Title: mod_rewrite crash course: what and how
Post by: MaThIbUs on February 15, 2004, 01:17:46 pm
Thanks for the great hack, rbl!

Some additions:

Title: mod_rewrite crash course: what and how
Post by: Hein Traag on February 23, 2004, 08:17:29 pm
As i am a complete n00b at hacking does anyone have the modified files in a zip somewhere ?
Title: mod_rewrite crash course: what and how
Post by: Joachim Müller on February 24, 2004, 08:16:19 am
it was stated before, but be warned again: this mod is not meant for you if you don't know at all what you're doing. If you're a newbie, don't try this, unless you can live with your website being inaccessible for some time...

GauGau
Title: mod_rewrite crash course: what and how
Post by: Hein Traag on February 24, 2004, 09:40:28 am
Whoo supportive. What i'm trying to point out is that the above is about modifying some files of the coppermine gallery.. which might as well be made downloadable as a package imho as a service to those who would like to simplify their urls but are not very skilled (yet) as some of the more experienced users on this board.

You can't expect everyone to be as skilled as the developers or contributors to coppermine now can you ?
Title: mod_rewrite crash course: what and how
Post by: hyperion on February 24, 2004, 09:58:43 am
This is not a mod that can easily be put in a zip file and expected to work for everyone who downloads it. If you can't follow the the thread and understand it, you have no business attempting this modification. You are welcome to try it, but do not complain if your entire website goes down.

Mind your manners.
Title: mod_rewrite crash course: what and how
Post by: Hein Traag on February 24, 2004, 11:09:40 am
I don't agree entirely on this. Sure it would not work for everyone but since the internet is big there is bound to be a fairly large group for whom it will work.

And since it would make coppermine more user friendly i see no reason why there shouldn't be a option to include this in coppermine (at your own risk).  

I did not mean to be impolite or anything before but if the only reason not to include a option in coppermine that shortens the urls is that it would not work for some people then your limiting the the spread of coppermine imho.
Title: mod_rewrite crash course: what and how
Post by: ariev on April 13, 2004, 03:24:36 am
I'm not promoting this exactly, but found it as a utility that will enable long URLs to be setup as anything you want. I haven't used the script but it looks good.

http://www.scripts24.com/iredirector/subdirectory/index.php

I guess the same thing could be done with mod_rewrite too.
Title: Re: mod_rewrite crash course: what and how
Post by: kaitou on April 27, 2004, 07:39:31 am
Heh nice, very cool hack.  ;D
Definetly not for the php illiterate.
Just got it working at my site: http://www.animegalleries.net
Only thing I can't find, is where the breadcrumb is generated, to hack those url's also. Can someone point me to the file where I could find that?

And I would -love- to see this included in the next version of coppermine. I know you said you don't want to have features that only work for some people, to avoid confusions, but you could have the option detect if it is on a apache server or not, and if not, it wouldn't even show up in the admin? And then just ask if to enable it or not, same way as one has to pick GD or ImageMagik.
Title: Re: mod_rewrite crash course: what and how
Post by: binocle on May 18, 2004, 09:09:57 pm
Thank you very much,

I use this hack in a different way here :

http://www.surf-bzh.com/coppermine_dir/index.php

I have not finished yet, i have some problems for displaying image, but I work on it !

my main problem is about the url of category of  the table given in the top of album and image

example :

(http://www.surf-bzh.com/divers/cop1.jpg)

I don't find the variables to change ?

Can you help me  ;)

thanks
Title: Re: mod_rewrite crash course: what and how
Post by: binocle on June 01, 2004, 10:16:48 pm
bump ???
Title: Re: mod_rewrite crash course: what and how
Post by: emrcia on September 13, 2004, 01:37:11 am
This is something important in order to let google spyder the gallery. This is needed in order to let adsense work in our galleries. Are you so kind to explain this modification a little bit more detailed?
It seem to work in my server, but I don't know wich variables an a href to change. I need a little more help in this.
Thank you.
 
Title: Re: mod_rewrite crash course: what and how
Post by: Lombi on September 15, 2004, 06:21:35 am
Perhaps someone should find this handy as well:
http://www.lombergar.com/v4/posts-q227-last.htm

I made a quick blog while upgrading the system to do mod_rewrites and it should reflect the changes his contribution had untill 1.3.2.
Title: Re: mod_rewrite crash course: what and how
Post by: emrcia on September 18, 2004, 01:48:28 am
Thank you!!
Every thing seem to be ok, but there is a problem with the last images thumbnails. When I click on them I obtain a 404 error and they all have the same url:
http://www.mysite.com/galery/album/lastup&cat=0/img/0
Title: Re: mod_rewrite crash course: what and how
Post by: emrcia on September 29, 2004, 11:31:34 am
and so on with last comments and others...
Title: Re: mod_rewrite crash course: what and how
Post by: Tranz on September 29, 2004, 11:35:16 am
emrcia,

It would have been more useful if you gave us a URL to an actual site.
Title: Re: mod_rewrite crash course: what and how
Post by: RatKing on September 30, 2004, 12:07:00 am
This is a real sweet mod, I spend a bout an hour or two getting al the links working but it was worth it. :)
Title: Re: mod_rewrite crash course: what and how
Post by: RatKing on September 30, 2004, 06:52:41 pm
@emrcia : The problem you are describing is caused by an issue in your theme.php file in the theme_display_thumbnails function. As far as I can tell this has not been modifed correctly. I hade the same issue but that has been solved in my theme.

The line that starts with:
Code: [Select]
$cat_link = is_numeric($aid) ? '' is the one thats causing the trouble...

Also make sure you look at the stuff under:     
Code: [Select]
foreach($thumb_list as $thumb) { in the same function that also needs changing it is not listed in the mod but it needs to be altered as well.  ;)
Title: Re: mod_rewrite crash course: what and how
Post by: julian on November 16, 2004, 11:37:15 pm
hi

i ahve used the hack in the appropriate way and that's fine except for the languages.So..when i call the URL http://mysite.com/lang/italian
(non default)   it displays me an 404 erorr but when i try in the same way but now with the default language it's ok.How it's possible? Maybe i haven't uderstand the way to call the URL's expecially the /lang URL's.
can i have an answer ??
thanx in advance
Title: Re: mod_rewrite crash course: what and how
Post by: farhan on December 30, 2004, 05:07:31 pm
can someone please explain the step 5 in a little detail ?

especially this part

Quote
I've changed cat with category and pos with img.
To know how to replace urls, use the code above (in .htaccess section) as a guide, example: replace thumbnails.php?album=$album with /album/$album or displayimage.php?album=$album&pos=$id for album/$album/img/$id

Thanks
Title: Re: mod_rewrite crash course: what and how
Post by: antisa33 on March 16, 2005, 02:19:16 am
Thank you rbl for your explications !
It's good for me !!
If someone want something mail me !
I have just one probleme to rewrite the slideshow link  ???
my website for kids in french http://www.coloriages.biz

Here is for the breadcrumb include/functions.inc

Code: [Select]
// Build the breadcrumb
function breadcrumb($cat, &$breadcrumb, &$BREADCRUMB_TEXT)
{
        global $album, $lang_errors, $lang_list_categories;
        global $CONFIG,$CURRENT_ALBUM_DATA, $CURRENT_CAT_NAME;
        if ($cat != 0) { //Categories other than 0 need to be selected
                $breadcrumb_array = array();
                if ($cat >= FIRST_USER_CAT) {
                        $user_name = get_username($cat - FIRST_USER_CAT);
                        if (!$user_name) $user_name = 'Mr. X';

                        $breadcrumb_array[] = array($cat, $user_name);
                        $CURRENT_CAT_NAME = sprintf($lang_list_categories['xx_s_gallery'], $user_name);
                        $row['parent'] = 1;
                } else {
                    $result = db_query("SELECT name, parent FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid = '$cat'");
                        if (mysql_num_rows($result) == 0) cpg_die(CRITICAL_ERROR, $lang_errors['non_exist_cat'], __FILE__, __LINE__);
                        $row = mysql_fetch_array($result);

                        $breadcrumb_array[] = array($cat, $row['name']);
                        $CURRENT_CAT_NAME = $row['name'];
                        mysql_free_result($result);
                }

                while($row['parent'] != 0){
                    $result = db_query("SELECT cid, name, parent FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid = '{$row['parent']}'");
                        if (mysql_num_rows($result) == 0) cpg_die(CRITICAL_ERROR, $lang_errors['orphan_cat'], __FILE__, __LINE__);
                        $row = mysql_fetch_array($result);

                        $breadcrumb_array[] = array($row['cid'], $row['name']);
                        mysql_free_result($result);
                } // while

                $breadcrumb_array = array_reverse($breadcrumb_array);
                $breadcrumb = '<a href=index.php>'.$lang_list_categories['home'].'</a>';
                $BREADCRUMB_TEXT = $lang_list_categories['home'];

                foreach ($breadcrumb_array as $category){
                        $link = "<a href=/category/{$category[0]}>{$category[1]}</a>";
                        $breadcrumb .= ' > ' . $link;
                        $BREADCRUMB_TEXT .= ' > ' . $category[1];
                }

        }else{ //Dont bother just add the Home link  to breadcrumb
                $breadcrumb = '<a href=index.php>'.$lang_list_categories['home'].'</a>';
                $BREADCRUMB_TEXT = $lang_list_categories['home'];
        }
        //Add Link for album if aid is set
        if (isset($CURRENT_ALBUM_DATA['aid'])){
                $link = "<a href=/album/".$CURRENT_ALBUM_DATA['aid']."> Coloriage ".$CURRENT_ALBUM_DATA['title']."</a>";
                $breadcrumb .= ' > ' . $link;
                $BREADCRUMB_TEXT .= ' > ' . $CURRENT_ALBUM_DATA['title'];
        }
}

thanks by !!
Title: Please help
Post by: antisa33 on March 16, 2005, 05:37:30 pm
Hello
All is OK for my rewrite but i have one problem !
When I clic coloriages.biz/index.php it's OK
But when i do coloriages.biz i have this error

L'album/la photo demandé(e) n'existe pas !

Fichier: /var/www/html/coloriages/include/functions.inc.php - Ligne: 863

debug say

Code: [Select]
USER:
------------------
Array
(
    [ID] => c0f08bf1d692090d03ce1e3f3516d045
    [am] => 1
    [liv] => Array
        (
            [0] => 168
            [1] => 1153
            [2] => 2
            [3] => 1200
            [4] => 1225
        )

    [sort] => da
    [lap] => 1
)

==========================
USER DATA:
------------------
Array
(
    [user_id] => 1
    [user_group] => 1
    [user_active] => YES
    [user_name] => isa
    [user_password] => ********
    [user_lastvisit] => 2005-03-16 16:12:49
    [user_regdate] => 2005-02-13 18:54:41
    [user_group_list] =>
    [user_email] =>
    [user_website] =>
    [user_location] =>
    [user_interests] =>
    [user_occupation] =>
    [user_actkey] =>
    [disk_max] => 0
    [disk_min] => 0
    [can_rate_pictures] => 1
    [can_send_ecards] => 1
    [ufc_max] => 3
    [ufc_min] => 3
    [custom_user_upload] => 0
    [num_file_upload] => 5
    [num_URI_upload] => 3
    [can_post_comments] => 1
    [can_upload_pictures] => 1
    [can_create_albums] => 1
    [has_admin_access] => 1
    [pub_upl_need_approval] => 1
    [priv_upl_need_approval] => 0
    [group_name] => Administrateurs
    [upload_form_config] => 3
    [group_quota] => 0
    [can_see_all_albums] => 1
    [group_id] => 1
    [groups] => Array
        (
            [1] => 1
        )

)

==========================
Queries:
------------------
Array
(
    [0] => SELECT extension, mime, content FROM cpg132_filetypes;
    [1] => SELECT * FROM cpg132_users WHERE user_id='1'AND user_active = 'YES' AND user_password != '' AND BINARY MD5(user_password) = 'b1f0d0142c7d8dfe494a2af0fd3ac491'
    [2] => SELECT MAX(group_quota) as disk_max, MIN(group_quota) as disk_min, MAX(can_rate_pictures) as can_rate_pictures, MAX(can_send_ecards) as can_send_ecards, MAX(upload_form_config) as ufc_max, MIN(upload_form_config) as ufc_min, MAX(custom_user_upload) as custom_user_upload, MAX(num_file_upload) as num_file_upload, MAX(num_URI_upload) as num_URI_upload, MAX(can_post_comments) as can_post_comments, MAX(can_upload_pictures) as can_upload_pictures, MAX(can_create_albums) as can_create_albums, MAX(has_admin_access) as has_admin_access, MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as  priv_upl_need_approval FROM cpg132_usergroups WHERE group_id in (1)
    [3] => SELECT group_name FROM  cpg132_usergroups WHERE group_id= 1
    [4] => DELETE FROM cpg132_banned WHERE expiry < 1110990892
    [5] => SELECT * FROM cpg132_banned WHERE ip_addr='82.66.25.34' OR ip_addr='82.66.25.34' OR user_id=1
)

==========================
GET :
------------------
Array
(
    [pos] => -
)

==========================
POST :
------------------
Array
(
)

==========================
VERSION INFO :
------------------
PHP version: 4.3.10 - OK
------------------
mySQL version: 3.23.58
------------------
Coppermine version: 1.3.2
==========================
Module: gd
------------------
GD Support enabled
GD Version bundled (2.0.28 compatible)
FreeType Support enabled
FreeType Linkage with freetype
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled
==========================
Module: mysql
------------------
Active Persistent Links 0
Active Links 1
Client API version 3.23.58
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /var/lib/mysql/mysql.sock
MYSQL_INCLUDE -I/usr/include/mysql
MYSQL_LIBS -L/usr/lib/mysql -lmysqlclient 
==========================
Module: zlib
------------------
ZLib Support enabled
Compiled Version 1.2.1.1
Linked Version 1.2.1.2
==========================
Server restrictions (safe mode)?
------------------
Directive | Local Value | Master Value
safe_mode | Off | Off
safe_mode_exec_dir | no value | no value
safe_mode_gid | Off | Off
safe_mode_include_dir | no value | no value
safe_mode_exec_dir | no value | no value
sql.safe_mode | Off | Off
disable_functions | escapeshellarg, , exec, passthru, proc_close, proc_get_status, proc_nice, proc_open, proc_terminate, shell_exec, system | escapeshellarg, , exec, passthru, proc_close, proc_get_status, proc_nice, proc_open, proc_terminate, shell_exec, system
file_uploads | On | On
include_path | .:/usr/share/pear | .:/usr/share/pear
open_basedir | no value | no value
==========================
email
------------------
Directive | Local Value | Master Value
sendmail_from | no value | no value
sendmail_path | /usr/sbin/sendmail -t -i | /usr/sbin/sendmail -t -i
SMTP | localhost | localhost
smtp_port | 25 | 25
==========================
Size and Time
------------------
Directive | Local Value | Master Value
max_execution_time | 90 | 90
max_input_time | 60 | 60
upload_max_filesize | 2M | 2M
post_max_size | 8M | 8M
==========================
Page generated in 0.063 seconds - 6 queries in 0.005 seconds - Album set :

I must have forget one / or something when i rewrite!

Thank you i wait  :-\\
Title: Re: mod_rewrite crash course: what and how
Post by: antisa33 on March 16, 2005, 07:56:14 pm
That's OK  ;D It was an error the htaccess  :P
Title: Re: mod_rewrite crash course: what and how
Post by: Mike_PL on March 27, 2005, 11:03:13 am
bug  :\'(
does anyone have the modified files in a zip somewhere or write a completed instructions?
Please.
Title: Re: mod_rewrite crash course: what and how
Post by: Mike_PL on March 29, 2005, 11:35:08 am
RBL - do you write completed instructions somtime?
This is no complet so I didnt instalation. Bug, bug, bug  :\'( :\'(

btw. Great mod!!
Title: Re: mod_rewrite crash course: what and how
Post by: Joachim Müller on March 29, 2005, 06:13:37 pm
bug  :\'(
does anyone have the modified files in a zip somewhere or write a completed instructions?
Please.
RBL - do you write completed instructions somtime?
This is no complet so I didnt instalation. Bug, bug, bug :\'( :\'(

btw. Great mod!!

Be more carefull with your wording: the word "bug" is not a very nice thing to say in this thread! You should take a look at the subject of this thread: this is not a mod, it's just a basic crash course on the mod_rewrite module and how to use it with coppermine. It only exists to give you an idea, if you need more details, you should read the apache http server manual and google for particular issues you have. RBL never said this thread contained all information about mod_rewrite, as it would require several books to show every aspect of it. Basically, my suggestion is: if you don't understand what you're doing, you shouldn't fiddle with mod_rewrite at all.
Instead, you should have read the whole thread, especially
This is not a mod that can easily be put in a zip file and expected to work for everyone who downloads it. If you can't follow the the thread and understand it, you have no business attempting this modification. You are welcome to try it, but do not complain if your entire website goes down.

Mind your manners.
- as you can see, there have been others who didn't even bother to read; your reply won't win you friends here.

Joachim
Title: Re: mod_rewrite crash course: what and how
Post by: LinkBliss on March 30, 2005, 12:54:18 am
has anyone been successful with this hack?

I did use his hack (wish I had found it earlier), but I did something similar posted in another section of this site --
http://forum.coppermine-gallery.net/index.php?topic=12672.0

The gallery is at http://www.rainbowseeker.us

Eric
Title: Re: mod_rewrite crash course: what and how
Post by: LinkBliss on March 30, 2005, 12:56:49 am
This is not a mod that can easily be put in a zip file and expected to work for everyone who downloads it. If you can't follow the the thread and understand it, you have no business attempting this modification.

Wordpress has a feature about "permalinks" which uses htaccess, very easy to use for any novice. I wonder if more apps will become smart like this eventually..

eric
Title: Re: mod_rewrite crash course: what and how
Post by: JeWelz on March 30, 2005, 05:43:31 pm
This is awesome!!!!  Thank you!!! Quite a powerful functionality.

I'm implementing it a little differently but it is a cosmetic differene (I think) (more like the other hack posted on this topic).

I'm writting because I could use some help finding relevant coppermine code. Three things...

Thing #1 - Where do I find the code to make page two also be an html link:
http://www.absolutestockphoto.com/beta/thumbnails91.html (then click on page 2 to see my issue)

Thing #2 - I cannot find in the coppermine code where I can change the album list for a user:
http://www.absolutestockphoto.com/beta/index.php?cat=10020  

Thing #3 - I see in the .htaccess example that searches can be converted but I cannot get the darn "?" out of the url - where do I do this, I may be off base on what I'm trying to change.

Let me know what additional info I should provide.

Any assistance would be greatly apreciated!
Thanks!
Julie
Title: Re: mod_rewrite crash course: what and how
Post by: cmooz on May 09, 2005, 02:27:30 pm
can someone pls upload the diplayimage.php for cpg version 1.3.3

thx
Title: Re: mod_rewrite crash course: what and how
Post by: Joachim Müller on May 09, 2005, 03:43:17 pm
what's that suppossed to be good for? You can't just use one file from the package, you'll need the full package. I also can't see how this is suppossed to be related to the mod_rewrite thread you've replied to: don't try to hijack threads >:(!
You can get single files from the stable branch of the web cvs; displayimage.php is here for example: http://cvs.sourceforge.net/viewcvs.py/*checkout*/coppermine/stable/displayimage.php?rev=1.11

Title: Re: mod_rewrite crash course: what and how
Post by: onr on August 10, 2005, 06:52:36 pm
hi

i ahve used the hack in the appropriate way and that's fine except for the languages.So..when i call the URL http://mysite.com/lang/italian
(non default)   it displays me an 404 erorr but when i try in the same way but now with the default language it's ok.How it's possible? Maybe i haven't uderstand the way to call the URL's expecially the /lang URL's.
can i have an answer ??
thanx in advance

I have the same ploblem. The languages work only when I am on the index.php file but not if I am deeper in the gallery like
http://mysite.com/album/31/lang/italian. Then it doesn't work. Has anyone found any hacks around this problem?
Many thanks
Oliver
Title: Re: mod_rewrite crash course: what and how
Post by: bertot on September 26, 2005, 08:35:39 am
First of all, sorry for my english but I am French.
I have began to use Coppermine and it seems great.
I want to install this mod on my website mostly to have a better searchengine ranking.

But before to install it I was wonderng if it could be possible to get such kind of adresses :
http://www.mywebsite.com/coppermine/title-of-the-album/title-of-the-picture

instead of
http://www.mywebsite.com/coppermine/album/17/img/27

If it could be possible , it would be wonderfull ... it surely will help a lot for a better ranking on all engines.

thanks for your answer

Joachim
Title: Re: mod_rewrite crash course: what and how
Post by: olti on November 24, 2005, 11:33:09 am
Look here: http://forum.coppermine-gallery.net/index.php?topic=9084.0

http://www.hamaraphotos.com/
Title: Re: mod_rewrite crash course: what and how
Post by: freesouljah on December 23, 2005, 03:13:37 am
I played with this for a few hours to get it to work...a lot of the time was spent trying to figure out tiny errors that were overlooked by the original posters....since it has been so long since their original posts, I decided to go ahead and make a mod out of this...with code changes and all....finally giving something back to the coppermine community that has given me so much  ;D

so...if you want to make this it's own topic, that would make sense, since the little errors in this topic tripped me up on the changes...

if you have questions, I might not be able to answer them since I just figured this out...but it might be worth trying...

anyway, the mod is attached  8)

[edit] I made some minor adjustments to fix the slideshow, view full sized image, edit image, most viewed, last uploaded, and  breadcrumb - those fixes are now in the attachment [/edit]
Title: Re: mod_rewrite crash course: what and how
Post by: cosmoweb on May 22, 2007, 08:06:21 pm
mod rewrite for the 1.4.10?
Title: Re: mod_rewrite crash course: what and how
Post by: tanujdude91 on June 27, 2007, 08:55:45 am
hi...
i am neither a newbie nor a pro in php...
can anyone explain me the 4th step plssss...

thanks.....  :D
Title: locking topic
Post by: tg1xDjkv on May 14, 2011, 02:44:37 am
topic locked