Avatar of Spikeuk30
Spikeuk30

asked on 

Apache - url redirect from Subfolder url to https.

Good Morning,

im no linux guru but would like some help.

we have a website.   www.test.com

there is a sub folder containing access to staff login page.  

http:\\test.com\staff\

I have now set this up with a ssl certificate so now we have

https:\\staff.test.com

I need to either block access directly to the url http:\\test.com\staff\

or redirect back to https:\\staff.test.com  (which ever is easiest  )

I tried a Virtualhost entry in my apache config file but it doesnt seem to like the subfolder.  (I also need to redirect  http:\\staff.test.com to https:\\staff.test.com  this bit seems to be working details below)

I tried this:

# the one needs to redirect  http://test.com/staff   to https://staff.test.com - not working?

<VirtualHost *:80>
  ServerName www.test.com/staff
  ServerAlias https://staff.test.com  http://test.com/staff
  Redirect / https://staff.test.com/
</VirtualHost>

#This one below works - it redirect http://staff.test.com to https://staff.test.com

<VirtualHost *:80>
  ServerName http://staff.test.com
  ServerAlias https://staff.test.com http://staff.test.com
  Redirect / https://staff.test.com/
</VirtualHost>


Any help would be appeciated...
Apache Web ServerLinuxWeb Servers

Avatar of undefined
Last Comment
Spikeuk30
ASKER CERTIFIED SOLUTION
Avatar of Rory Clerkin
Rory Clerkin
Flag of Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Spikeuk30
Spikeuk30

ASKER

I managed to do this myself,  I created a  .htaccess with a perm redirect to the https url.

Now working all ok ....
Linux
Linux

Linux is a UNIX-like open source operating system with hundreds of distinct distributions, including: Fedora, openSUSE, Ubuntu, Debian, Slackware, Gentoo, CentOS, and Arch Linux. Linux is generally associated with web and database servers, but has become popular in many niche industries and applications.

71K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo