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.  


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


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/

#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/

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

Avatar of undefined
Last Comment

8/22/2022 - Mon
Rory Clerkin

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

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

Now working all ok ....
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy