Index: perl_lib/EPrints/Apache/Auth.pm
===================================================================
--- perl_lib/EPrints/Apache/Auth.pm	(revision 1)
+++ perl_lib/EPrints/Apache/Auth.pm	(working copy)
@@ -142,7 +142,7 @@
 		{
 			my $target_url = $r->uri;
 			$target_url =~ s/([^A-Z0-9])/sprintf( "%%%02X", ord($1) )/ieg;
-			my $login_url = $session->get_repository->get_conf( "perl_url" )."/users/login?target=$target_url";
+			my $login_url = $session->get_repository->get_conf( "users_url" )."/users/login?target=$target_url";
 			EPrints::Apache::AnApache::send_status_line( $r, 302, "Need to login first" );
 			EPrints::Apache::AnApache::header_out( $r, "Location", $login_url );
 			EPrints::Apache::AnApache::send_http_header( $r );
Index: perl_lib/EPrints/Session.pm
===================================================================
--- perl_lib/EPrints/Session.pm	(revision 1)
+++ perl_lib/EPrints/Session.pm	(working copy)
@@ -1167,7 +1167,7 @@
 
 	my @core = $screen->list_items( "key_tools" );
 	my @other = $screen->list_items( "other_tools" );
-	my $url = $self->get_repository->get_conf( "perl_url" )."/users/home";
+	my $url = $self->get_repository->get_conf( "users_url" )."/users/home";
 
 	my $first = 1;
 	foreach my $tool ( @core )
Index: perl_lib/EPrints/DataObj/SavedSearch.pm
===================================================================
--- perl_lib/EPrints/DataObj/SavedSearch.pm	(revision 1)
+++ perl_lib/EPrints/DataObj/SavedSearch.pm	(working copy)
@@ -400,7 +400,7 @@
 			$last_month."-" );
 	}
 
-	my $url = $self->{session}->get_repository->get_conf( "perl_url" ).
+	my $url = $self->{session}->get_repository->get_conf( "users_url" ).
 		"/users/home?screenid=SavedSearh::View";
 	my $freqphrase = $self->{session}->html_phrase(
 		"lib/saved_search:".$freq );
Index: perl_lib/EPrints/DataObj/User.pm
===================================================================
--- perl_lib/EPrints/DataObj/User.pm	(revision 1)
+++ perl_lib/EPrints/DataObj/User.pm	(working copy)
@@ -801,14 +801,14 @@
 {
 	my( $self ) = @_;
 
-	return $self->{session}->get_repository->get_conf( "perl_url" )."/users/home?screen=User::View&userid=".$self->get_value( "userid" );
+	return $self->{session}->get_repository->get_conf( "users_url" )."/users/home?screen=User::View&userid=".$self->get_value( "userid" );
 }
 
 sub get_control_url
 {
 	my( $self ) = @_;
 
-	return $self->{session}->get_repository->get_conf( "perl_url" )."/users/home?screen=User::View&userid=".$self->get_value( "userid" );
+	return $self->{session}->get_repository->get_conf( "users_url" )."/users/home?screen=User::View&userid=".$self->get_value( "userid" );
 }
 	
 
@@ -911,7 +911,7 @@
 
 	if( $list->count > 0 || $self->get_value( "mailempty" ) eq 'TRUE' )
 	{
-		my $url = $self->{session}->get_repository->get_conf( "perl_url" ).
+		my $url = $self->{session}->get_repository->get_conf( "users_url" ).
 			"/users/record";
 		my $freqphrase = $self->{session}->html_phrase(
 			"lib/saved_search:".$freq ); # nb. reusing the SavedSearch.pm phrase
Index: perl_lib/EPrints/DataObj/EPrint.pm
===================================================================
--- perl_lib/EPrints/DataObj/EPrint.pm	(revision 1)
+++ perl_lib/EPrints/DataObj/EPrint.pm	(working copy)
@@ -1597,7 +1597,7 @@
 {
 	my( $self ) = @_;
 
-	return $self->{session}->get_repository->get_conf( "perl_url" ).
+	return $self->{session}->get_repository->get_conf( "users_url" ).
 		"/users/home?screen=EPrint::View&eprintid=".
 		$self->get_value( "eprintid" )
 }
Index: perl_lib/EPrints/Plugin/Screen/Public/RequestCopy.pm
===================================================================
--- perl_lib/EPrints/Plugin/Screen/Public/RequestCopy.pm	(revision 1)
+++ perl_lib/EPrints/Plugin/Screen/Public/RequestCopy.pm	(working copy)
@@ -156,7 +156,7 @@
 		# Contact is registered user and EPrints holds requested document
 		# Send email to contact with accept/reject links
 
-		my $url =  $session->get_repository->get_conf( "perl_url" ) .
+		my $url =  $session->get_repository->get_conf( "users_url" ) .
 			"/users/home?screen=Request::Respond&requestid=" . $request->get_id;
 
 		$mail->appendChild( $session->html_phrase( "request/request_email:links",
Index: perl_lib/EPrints/Plugin/Export.pm
===================================================================
--- perl_lib/EPrints/Plugin/Export.pm	(revision 1)
+++ perl_lib/EPrints/Plugin/Export.pm	(working copy)
@@ -185,7 +185,7 @@
 	my $format = $1;
 
 	my $url = $plugin->{session}->get_repository->get_conf( "perl_url" );
-	$url .= "/users" if $staff;
+	$url = $plugin->{session}->get_repository->get_conf( "users_url" )."/users" if $staff;
 	$url .= "/export/".$dataobj->get_id."/".$format;
 	$url .= "/".$plugin->{session}->get_repository->get_id;
 	$url .= "-".$dataobj->get_dataset->confid."-".$dataobj->get_id.$plugin->param("suffix");
Index: cgi/users/export
===================================================================
--- cgi/users/export	(revision 1)
+++ cgi/users/export	(working copy)
@@ -42,7 +42,7 @@
 my $id = $1;
 my $afterid = $2;
 my $format = $3;
-my $export_url = $session->get_repository->get_conf( "perl_url" )."/users/export";
+my $export_url = $session->get_repository->get_conf( "users_url" )."/users/export";
 
 if( !defined $id ) {
 	error( $session, $session->html_phrase( "cgi/export:no_id" ) );
Index: cgi/users/home
===================================================================
--- cgi/users/home	(revision 1)
+++ cgi/users/home	(working copy)
@@ -36,7 +36,7 @@
 
 EPrints::ScreenProcessor->process( 
 	session=>$session, 
-	url=>$session->get_repository->get_conf( "perl_url" )."/users/home" );
+	url=>$session->get_repository->get_conf( "users_url" )."/users/home" );
 
 $session->terminate;
 
Index: lib/lang/en/phrases/system.xml
===================================================================
--- lib/lang/en/phrases/system.xml	(revision 1)
+++ lib/lang/en/phrases/system.xml	(working copy)
@@ -532,7 +532,7 @@
     <epp:phrase id="cgi/login:bind">yes (more secure)</epp:phrase>
     <epp:phrase id="cgi/login:dont_bind">no (more convenient)</epp:phrase>
     <epp:phrase id="cgi/login:failed">Incorrect username or password.</epp:phrase>
-    <epp:phrase id="cgi/login:logged_in_as"><p>You are already logged in as <epc:pin name="name"/>.</p> <p>If you wish to log in as a different user you must <a href="{$config{perl_url}}/users/logout">Logout</a> first.</p></epp:phrase>
+    <epp:phrase id="cgi/login:logged_in_as"><p>You are already logged in as <epc:pin name="name"/>.</p> <p>If you wish to log in as a different user you must <a href="{$config{users_url}}/users/logout">Logout</a> first.</p></epp:phrase>
     <epp:phrase id="cgi/login:title">Login</epp:phrase>
     <epp:phrase id="cgi/login:message">Login successful.</epp:phrase>
     <epp:phrase id="cgi/login:link_text"><p>You may now view <epc:pin name="link">your requested document</epc:pin>.</p></epp:phrase>
Index: lib/defaultcfg/cfg.d/20_baseurls.pl
===================================================================
--- lib/defaultcfg/cfg.d/20_baseurls.pl	(revision 1)
+++ lib/defaultcfg/cfg.d/20_baseurls.pl	(working copy)
@@ -2,11 +2,14 @@
 # path of site on server with no trailing slash
 $c->{urlpath} = "";
 
+my $root_url =  $c->{host}.($c->{port}!=80?":".$c->{port}:"").$c->{urlpath};
+
 # Server of static HTML + images, including port but without trailing
 #slash
-$c->{base_url} = "http://$c->{host}".($c->{port}!=80?":".$c->{port}:"").$c->{urlpath};
+$c->{base_url} = "http://".$root_url;
 
 # Mod_perl script base URL
+# cgi scripts under the users folder will be done separatly as they may require https
 $c->{perl_url} = $c->{base_url}."/cgi";
 
 # URL of secure document file hierarchy. EPrints needs to know the
@@ -14,5 +17,10 @@
 # to extract the document number from the url, eg.
 # http://www.lemurprints.org/secure/00000120/01/index.html
 #$c->{secure_urlpath} = "/secure"; 
-#$c->{secure_url} = $c->{base_url}.$c->{secure_urlpath};
+#$c->{secure_url} = "https://".$root_url.$c->{secure_urlpath};
 
+# Mod_perl scripts for users scripts
+# If not using https, make this the same as perl_url
+# Otherwise make it  $c->{secure_url} ."/cgi"
+$c->{users_url} = $c->{perl_url};
+#$c->{users_url} = $c->{secure_url} ."/cgi";
\ No newline at end of file
Index: lib/defaultcfg/cfg.d/urls.pl
===================================================================
--- lib/defaultcfg/cfg.d/urls.pl	(revision 1)
+++ lib/defaultcfg/cfg.d/urls.pl	(working copy)
@@ -10,7 +10,7 @@
 $c->{frontpage} = "$c->{base_url}/";
 
 # The user area home page URL
-$c->{userhome} = "$c->{perl_url}/users/home";
+$c->{userhome} = "$c->{users_url}/users/home";
 
 # By default all paths are rewritten to the relevant language directory
 # except for /cgi/. List other exceptions here.
Index: lib/defaultcfg/lang/en/static/help/index.xpage
===================================================================
--- lib/defaultcfg/lang/en/static/help/index.xpage	(revision 1)
+++ lib/defaultcfg/lang/en/static/help/index.xpage	(working copy)
@@ -140,7 +140,7 @@
 and password which must be confirmed. The system will email you a confirmation
 URL to visit to enable the password.</p>
 <p>Before you can start uploading
-items, you need to fill out some personal details into a form (<a href="{$config{perl_url}}/users/record"><epc:print expr="$config{perl_url}" />/users/record</a>),
+items, you need to fill out some personal details into a form (<a href="{$config{users_url}}/users/record"><epc:print expr="$config{users_url}" />/users/record</a>),
 the registration e-mail will contain instruction on how to do this. This
 same form is used to change user details once registered. </p>
 
@@ -148,7 +148,7 @@
 <h2>Depositing Records</h2>
 
 <p>The first thing you'll need to do, after registering, is fill out your
-user record using the form at <a href="{$config{perl_url}}/users/record"><epc:print expr="$config{perl_url}" />/users/record</a>. When
+user record using the form at <a href="{$config{users_url}}/users/record"><epc:print expr="$config{users_url}" />/users/record</a>. When
 you click on ``Deposit Papers,'' you'll see an option saying ``View/change
 your user record'': Select this option. The user record form is described
 below. </p>
Index: lib/defaultcfg/workflows/eprint/default.xml
===================================================================
--- lib/defaultcfg/workflows/eprint/default.xml	(revision 1)
+++ lib/defaultcfg/workflows/eprint/default.xml	(working copy)
@@ -28,7 +28,7 @@
 
   <stage name="core">
 
-    <component><field ref="title" required="yes" input_lookup_url="{$config{perl_url}}/users/lookup/title_duplicates" input_lookup_params="eprintid={eprintid}" /></component>
+    <component><field ref="title" required="yes" input_lookup_url="{$config{users_url}}/users/lookup/title_duplicates" input_lookup_params="eprintid={eprintid}" /></component>
     <component><field ref="abstract"/></component>
 
     <epc:if test="type = 'monograph'">
@@ -49,12 +49,12 @@
 
     <epc:choose>
       <epc:when test="type.one_of('book','book_section')">
-        <component><field ref="creators" input_lookup_url="{$config{perl_url}}/users/lookup/name" /></component>
+        <component><field ref="creators" input_lookup_url="{$config{users_url}}/users/lookup/name" /></component>
         <component><field ref="corp_creators"/></component>
-        <component><field ref="editors" input_lookup_url="{$config{perl_url}}/users/lookup/name" /></component>
+        <component><field ref="editors" input_lookup_url="{$config{users_url}}/users/lookup/name" /></component>
       </epc:when>
       <epc:otherwise>
-        <component><field ref="creators" required="yes" input_lookup_url="{$config{perl_url}}/users/lookup/name" /></component>
+        <component><field ref="creators" required="yes" input_lookup_url="{$config{users_url}}/users/lookup/name" /></component>
         <component><field ref="corp_creators"/></component>
       </epc:otherwise>
     </epc:choose>
@@ -159,8 +159,8 @@
         <field ref="official_url"/>
       </epc:if>
       <epc:if test="type = 'article'">
-        <field ref="publication" required="yes" input_lookup_url="{$config{perl_url}}/users/lookup/journal_by_name" />
-        <field ref="issn" input_lookup_url="{$config{perl_url}}/users/lookup/journal_by_issn" />
+        <field ref="publication" required="yes" input_lookup_url="{$config{users_url}}/users/lookup/journal_by_name" />
+        <field ref="issn" input_lookup_url="{$config{users_url}}/users/lookup/journal_by_issn" />
         <field ref="publisher" />
         <field ref="official_url"/>
         <field ref="volume"/>
@@ -266,7 +266,7 @@
     <epc:if test="type = 'conference_item'">
       <component type="Field::Multi">
         <title>Event Details</title>
-        <field ref="event_title" input_lookup_url="{$config{perl_url}}/users/lookup/event_by_name" required="yes" />
+        <field ref="event_title" input_lookup_url="{$config{users_url}}/users/lookup/event_by_name" required="yes" />
         <field ref="event_type" required="yes" />
         <field ref="event_location"/>
         <field ref="event_dates"/>
