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...
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Red-KingIT ManagerCommented:
You can use a meta tag refresh to automatically redirect anyone to the https site
Create or edit the index.html (or whatever other default file type you might be using) within http://test.com/staff 
Edit the Head of the html page to include the following;

    <title>Page Redirect</title>      
    <meta http-equiv="refresh" content="0;URL='https://staff.test.com'" />    

Open in new window

The zero before the URL is the amount of time it waits before redirecting. If you want to give somebody time to read a message on the page you can set that to 5 (which is in seconds).


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Spikeuk30Author Commented:
I managed to do this myself,  I created a  .htaccess with a perm redirect to the https url.

Now working all ok ....
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.