EPrints Technical Mailing List Archive

Message: #01094


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

[EP-tech] Re: How to emulate former persistent uri schemes?


Am 14.09.2012 11:46, schrieb Florian Heß:
Hi,

to have persistent urls is just fine. Yet, as a logical consequence,
that means that the validity/availability of a URI must be guaranteed
even no matter which repository software happens to work behind the scenes.

Thus, how can I make EPrints emulate our former persistent document URLs
according to the scheme $base/volltexte/$year/$id[/$ext/$file]? Hope
that is possible in EPrints without hacking EPrints::Apache:Rewrite, is it?
(The year part doesn't need to match properly, i.e. whether a document
is cited by volltexte/1999/445 or volltexte/2071/441, it should be no
problem so we avoid requesting the database. The ext part neither.)

Mod_rewrite rules or ScriptAlias directives (by which we could install a
cgi script to handle anything after "/volltexte/...") do not seem to be
respected while that module is in effect, right?



Hi,

just as a note for those who run into the same problem:

currently trying with

    # in: archives/heidok/cfg.d/20_baseurls.pl
    $c->{rewrite_exceptions} = [ '/heidok/volltexte' ];

and

<VirtualHost *:80>
    ...
ScriptAliasMatch /([a-z]+?)dok/volltexte/ /eprints/cgi/ubhd_emulate_legacyurl
    ...
</VirtualHost>

$ cat /eprints/cgi/ubhd_emulate_legacyurl
#!/usr/bin/perl

use strict;

use FindBin;
use lib "$FindBin::Bin/../perl_lib";

# we run in plain CGI mode, not in EPrints mod_perl environment:
use EPrints qw(no_check_user);

my $query = $ENV{REQUEST_URI};
my (undef,  $instance, undef, $id,undef,$file) = split /\/+/, $query;
  # ^domain            ^ year     ^ ext

my $repo = EPrints->new->repository($instance);

# TODO: redirection

__END__

Works fine so far ... :-)


Kind regards,
F Heß


--
UB Heidelberg (Altstadt)
Plöck 107-109, 69117 HD
- Informationstechnik
- WWW-Redaktion
http://www.ub.uni-heidelberg.de/