<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div style="padding-bottom: 10px; padding-top: 5px;">
<div style="padding:12px; border:1px solid #8D3970; background-color:#F7F9FA; color:#8D3970; font-size:14px; line-height:22px; font-family: Calibri, Arial, Helvetica, sans-serif;">
<strong>CAUTION:</strong> This e-mail originated outside the University of Southampton.
</div>
</div>
<div>
<p>Hi David!</p>
<p><br>
</p>
<p>&nbsp;being it almost 99% of the archive and some thousands of items, it is quite difficult to have thousands lines $c-&gt;{rewrite_exceptions} but seems the only possible path, being the perl handler running before rewriterule. In other cases, it is possible to
 use LocationMatch to set the default handler thus running rewrite rules.</p>
<p><br>
</p>
<p>Another option could be rename the old archive? Thus we could use the virtualhost to do just redirects, and access old items (we need them internally anyway).</p>
<p><br>
</p>
<p>Other than changing the base url, change apache configs, running generate_static / generate_abstracts, what would I need to rename the old archive?<br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">Il 14/03/22 18:00, David R Newman ha scritto:<br>
</div>
<blockquote type="cite" cite="mid:e19572b4-75f3-903f-6b71-0530d8a3ee22@ecs.soton.ac.uk">
<p><font size="4">Hi both,</font></p>
<p><font size="4"><br>
</font></p>
<p><font size="4">I have been doing something similar recently, albeit for abstract pages.&nbsp; I prefer the brute force approach of adding to $c-&gt;{rewrite_exceptions} and them manually adding the Apache Mod Rewrite rules to an archive level file called cfg/apache_redirects.conf
 and then including that in&nbsp; cfg/apachevhost.conf and/or ssl/securevhost.conf.&nbsp; You could write a script to programmatically generate this and the cfg.d file for rewrite_exceptions from a mapping file.</font></p>
<p><font size="4"><br>
</font></p>
<p><font size="4">I had considered doing something that would allow you to add a metadata field called redirect_url or similar that you could just edit as a user (probably an admin or editor only if the item is live), which could then be used to automatically
 redirect off site.&nbsp; However, that would require some changes at a core level, which feels a bit excessive for tackling this problem.
<br>
</font></p>
<p><font size="4"><br>
</font></p>
<p><font size="4">One option, if you want to redirect just from abstract pages, is you could test for this new redirect_url field being set and if it is embedding some JavaScript in the abstract page that redirects to the new URL.&nbsp; That is a bit hacky but makes
 it easier to add new items to be redirected in future rather than having to maintain a mappings list independent of the database.&nbsp; However, this is no use if you want to redirect document URLs.&nbsp; I am not sure whether that is what you want to do?</font></p>
<p><font size="4"><br>
</font></p>
<p><font size="4">Regards</font></p>
<p><font size="4"><br>
</font></p>
<p><font size="4">David Newman<br>
</font></p>
<p><font size="4"><br>
</font></p>
<p><font size="4"><br>
</font></p>
<div class="moz-cite-prefix">On 14/03/2022 4:07 pm, Yuri via Eprints-tech wrote:<br>
</div>
<blockquote type="cite" cite="mid:6f2ecd09-c345-4a1c-cdd2-22b043d61251@alfa.it">
<div style="padding-bottom: 10px; padding-top: 5px;">
<div style="padding:12px; border:1px solid #8D3970;
            background-color:#F7F9FA; color:#8D3970; font-size:14px;
            line-height:22px; font-family: Calibri, Arial, Helvetica,
            sans-serif;">
<strong>CAUTION:</strong> This e-mail originated outside the University of Southampton.
</div>
</div>
<div>
<p>Hi John!</p>
<p><br>
</p>
<p>&nbsp;thanks for sharing the gist. The objects are about 10.000, so I should load the map from a file. Unfortunately, It is an old Eprints without the EP_TRIGGER_URL_REWRITE but I think I just can copy the code at the begin of Rewrite.pm.</p>
<p><br>
</p>
<p>Thanks!<br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">Il 14/03/22 16:35, John Salter ha scritto:<br>
</div>
<blockquote type="cite" cite="mid:DU2PR03MB7895D7192AF8DEF34B574272C40F9@DU2PR03MB7895.eurprd03.prod.outlook.com">
<style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>
<div style="font-family: Calibri, Arial, Helvetica,
              sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Yuri,</div>
<div style="font-family: Calibri, Arial, Helvetica,
              sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I would use the EPrints URL Rewrite trigger.</div>
<div style="font-family: Calibri, Arial, Helvetica,
              sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica,
              sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
How many items are mapped to the other system?</div>
<div style="font-family: Calibri, Arial, Helvetica,
              sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Do you want to map landing page requests to one URL, and document requests to another URL (e.g. directly to the document in the other system)?</div>
<div style="font-family: Calibri, Arial, Helvetica,
              sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica,
              sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
This gist:&nbsp;<a href="https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fjesusbagpuss%2Fa5c574e1839612ef7e332d1d25edac42&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C27a26b84af52456eb54308da066e8ec8%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637829370926941715%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=lr6%2FWOqmDLAn%2BFv5E2Xt%2FkfJyFClCL5Mj614L6MCEdg%3D&amp;reserved=0" originalSrc="https://gist.github.com/jesusbagpuss/a5c574e1839612ef7e332d1d25edac42" shash="ZmoLhLhS+qSAfzM6zbuohdhqtuP3CDDbly3fP6AtsBJJVulDFUmVAWvEI73Sov8/V+8aUkBYMQvVAL+GZaKon/a0Lf+oqA6mrhPgLfM+nLWILdz/QSxUaRFcl4zd+yjt2VwEBA/r8M5B723+vGzRIkyB21AiJxvcpVqi9G1mGWM=" originalsrc="https://gist.github.com/jesusbagpuss/a5c574e1839612ef7e332d1d25edac42" shash="b44dHFpbhN1GdSocKLaWLq1p7nDWPawJepIOeoCL2yzPsUgf4MkIMtlj7ODevh2KofK4I/UUIxrYX9z163zX+f5d8bPI82RZbho9XVpc96seUp3jZ79SdvOE8E8t8Zydfz2qh3O76H8X3GS7R+VspSroInbIom+3l9n8kXutDTY=" id="LPNoLPOWALinkPreview" moz-do-not-send="true" class="moz-txt-link-freetext">https://gist.github.com/jesusbagpuss/a5c574e1839612ef7e332d1d25edac42</a>&nbsp;allows
 you to specify the eprintid / new locations in a hash.</div>
<div style="font-family: Calibri, Arial, Helvetica,
              sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
If all the new locations are on the same site, you could update line 19 to include the new base http URL, and just have the eprintid =&gt; otherid in the hash.</div>
<div style="font-family: Calibri, Arial, Helvetica,
              sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica,
              sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
As written, it will capture requests for anything starting with the EPrintID (requests for the landing page; downloads; thumbnail requests).</div>
<div style="font-family: Calibri, Arial, Helvetica,
              sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
You could map these URLs individually, and change the regex match on line 13 to redirect document requests to the new document URL; landing page requests to the new landing page etc.</div>
<div style="font-family: Calibri, Arial, Helvetica,
              sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica,
              sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hope that helps - let me know if you need more info.</div>
<div style="font-family: Calibri, Arial, Helvetica,
              sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica,
              sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Cheers,</div>
<div style="font-family: Calibri, Arial, Helvetica,
              sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
John</div>
<div style="font-family: Calibri, Arial, Helvetica,
              sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica,
              sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica,
              sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b>
<a class="moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:eprints-tech-bounces@ecs.soton.ac.uk" moz-do-not-send="true">
eprints-tech-bounces@ecs.soton.ac.uk</a> <a class="moz-txt-link-rfc2396E" href="mailto:eprints-tech-bounces@ecs.soton.ac.uk" moz-do-not-send="true">
&lt;eprints-tech-bounces@ecs.soton.ac.uk&gt;</a> on behalf of Yuri via Eprints-tech <a class="moz-txt-link-rfc2396E" href="mailto:eprints-tech@ecs.soton.ac.uk" moz-do-not-send="true">
&lt;eprints-tech@ecs.soton.ac.uk&gt;</a><br>
<b>Sent:</b> 14 March 2022 13:45<br>
<b>To:</b> EPrints.org Technical List <a class="moz-txt-link-rfc2396E" href="mailto:eprints-tech@ecs.soton.ac.uk" moz-do-not-send="true">
&lt;eprints-tech@ecs.soton.ac.uk&gt;</a><br>
<b>Subject:</b> [EP-tech] redirect some eprintid url to another site</font>
<div>&nbsp;</div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">CAUTION: This e-mail originated outside the University of Southampton.<br>
<br>
Hi!<br>
<br>
&nbsp; we're migrating many objects from eprints to various other platform. I<br>
would like to make redirects for the URLs of this documents. For example<br>
from myeprint.com/eprintid to another.site.com/otherid (I have a map<br>
with eprintid otherurl)<br>
<br>
I'm trying to do it with RewriteMap and RewriteRule but Eprints define<br>
the perl handler to manage urls (PerlTransHandler<br>
EPrints::Apache::Rewrite) to handle rewrites. I would like not to use<br>
cfg.d/url.pl because there are a lot of objects.<br>
<br>
Any idea? Should I patch Rewrite.pm to do it internally from a mapfile?<br>
Return DECLINED? I don't know if it is worth the time, I would prefer a<br>
simpler solution.<br>
<br>
<br>
*** Options: <a href="https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmailman.ecs.soton.ac.uk%2Fmailman%2Flistinfo%2Feprints-tech&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C27a26b84af52456eb54308da066e8ec8%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637829370926941715%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=4VHvoCzd4396k6d9%2FqhMFMCTwDiaHgAPjGVBBGEZmMk%3D&amp;reserved=0" originalSrc="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech" shash="oJZ6ISI3fsIUfQsh6o6wk0lIgUQsG8Jqf2bsSqhnQqIkoKs6x9Mo1KUxwur1xTEy7T5EwMKvfTs+ydO8sFs+c1ESET6jrBymdx++QqMQSkSVctMzA7VdlCceAIN6URk0lu9Xw9fPdrA6bIOU3WZ1T+PDYdE0OgHfeOKNFsXWh74=" originalsrc="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech" shash="C21EGj1RPGAzVDIBDhgXWRNcS1QyfEcwz7ed2NrBISAhVVPVOidmXHci3qi6cw+bHxnhuCW/t90KaQLSQJ4Gs0/WDOArto6BKeyyoFVpt4syMOmX8bppmZTKi/ID9tZJaZrbrCBPU+IITK2GKdtRlpftG8jIfQxILoq9TBSTjDc=" moz-do-not-send="true">
https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmailman.ecs.soton.ac.uk%2Fmailman%2Flistinfo%2Feprints-tech&amp;amp;data=04%7C01%7CJ.Salter%40leeds.ac.uk%7C8bb7948ea1094eb8d25b08da05c18c2d%7Cbdeaeda8c81d45ce863e5232a535b7cb%7C1%7C0%7C637828626342660990%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;amp;sdata=CWsbLXKKlI%2FlywSS10%2F5e79FaeDpl8hbEyUcguQ%2FJDc%3D&amp;amp;reserved=0</a><br>
*** Archive: <a href="https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C27a26b84af52456eb54308da066e8ec8%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637829370926941715%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=bemMek13YjaWyEocoVHJtklYFjz1RgruMjfQGOjh5bI%3D&amp;reserved=0" originalSrc="http://www.eprints.org/tech.php/" shash="ZOlWipL1ZyUMa+bm3reagUwR5GONBRtQWiINP35X0XTTiz5TuG+KdVpvqddw7ki5qcbBgYzbIZrefR0WApiVD3eKBBfpGfb3hfxjx/CNq07/wT1IlW+KGPxqAFiaYf2usTfX8+KJWkUVgcbzmFfu3njJcD4ne3sLLTHb3uM7IOw=" originalsrc="http://www.eprints.org/tech.php/" shash="AoJqBQV/2ksVuQHhNMnolGrYj+4z9fVFOpet6LzR2NSgDIKc87nW/m+0hphGCSACDZ1VZagNGTdRdiJkX8HIZEz/Y9Wb70EYe90WNFOotv/XYjtuvltZaacjog+FG/tIgxrzWrtdhrnLsK/qmqCqPGjsIWiC2/arxsCpaheXOdQ=" moz-do-not-send="true">
https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;amp;data=04%7C01%7CJ.Salter%40leeds.ac.uk%7C8bb7948ea1094eb8d25b08da05c18c2d%7Cbdeaeda8c81d45ce863e5232a535b7cb%7C1%7C0%7C637828626342660990%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;amp;sdata=0XS6HmJAybExIQbUk8p%2FB1asLntaSGKGwoZ%2Fj96MfgQ%3D&amp;amp;reserved=0</a><br>
*** EPrints community wiki: <a href="https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C27a26b84af52456eb54308da066e8ec8%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637829370927097931%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=9xlykFxMzAbD%2F%2FkD%2FtuPYnxESLzAH2T6g1Fh8UcFw%2FY%3D&amp;reserved=0" originalSrc="http://wiki.eprints.org/" shash="V7HMnEfDI1a+kaxSodoJyxE17FvosmjnDJ3NbEnwgiarwTXyXv3lKQz9N3Nh/Z3hk+P8w1kAJV4NsG0WIRkhfCU29Kb8E2J0UUfuLjV8FIqIUcXWFEhv+iogpnZJEinT7x37EnmHOyq0jDRTwPhaaJT5xGtW3O4rDgiFB23Lq6U=" originalsrc="http://wiki.eprints.org/" shash="fKgi1lnieFYzxupLSeAaC5QNYQplJoWy2G/72vQpj5kiplyjtbkx/TfcHJ8T80zT8jCaJaYk5K/xAN2t/z4kt7nrSty4MN42JgltRqkR6XfvwasdPJMndoEXxLkulet4soinixUx5S20XbY7AMHeeUflPyj5zTHSybMwNF/TYC4=" moz-do-not-send="true">
https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;amp;data=04%7C01%7CJ.Salter%40leeds.ac.uk%7C8bb7948ea1094eb8d25b08da05c18c2d%7Cbdeaeda8c81d45ce863e5232a535b7cb%7C1%7C0%7C637828626342660990%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;amp;sdata=iViKROkkJ3nKNy0MbLq2S%2BA8O4pQUOck9JnBKCBDyes%3D&amp;amp;reserved=0</a><br>
</div>
</span></font></div>
</blockquote>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">*** Options: <a class="moz-txt-link-freetext" href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech" moz-do-not-send="true">http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a>
*** Archive: <a class="moz-txt-link-freetext" href="https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C27a26b84af52456eb54308da066e8ec8%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637829370927097931%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=NHCLujisOaSevWB%2F0TaAlesnP9divy2YJzpcjMVRj9k%3D&amp;reserved=0" originalSrc="http://www.eprints.org/tech.php/" shash="okdh2FPYNTXDJfM0b3HGGF7Q8v1NhKT1dk6xCEV92Ez5l61n0VXKUccIWno7bFmzQWTvRoXqDS7OUrE6LP7ypMtEb7LCkQVZ7y7EeVjLhr+/254UJaMa+OdwwVUE+5iyvOZfsgaQHKTrvpX/ilxzwuvNyZ2bMa6hyBdLhNdiRRw=" moz-do-not-send="true">http://www.eprints.org/tech.php/</a>
*** EPrints community wiki: <a class="moz-txt-link-freetext" href="https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;data=04%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C27a26b84af52456eb54308da066e8ec8%7C4a5378f929f44d3ebe89669d03ada9d8%7C0%7C0%7C637829370927097931%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&amp;sdata=9xlykFxMzAbD%2F%2FkD%2FtuPYnxESLzAH2T6g1Fh8UcFw%2FY%3D&amp;reserved=0" originalSrc="http://wiki.eprints.org/" shash="V7HMnEfDI1a+kaxSodoJyxE17FvosmjnDJ3NbEnwgiarwTXyXv3lKQz9N3Nh/Z3hk+P8w1kAJV4NsG0WIRkhfCU29Kb8E2J0UUfuLjV8FIqIUcXWFEhv+iogpnZJEinT7x37EnmHOyq0jDRTwPhaaJT5xGtW3O4rDgiFB23Lq6U=" moz-do-not-send="true">http://wiki.eprints.org/</a></pre>
</blockquote>
</blockquote>
</div>
</body>
</html>