×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Forcing HTTP to HTTPS and redirecting specific sub-page visitors to different URL

Forcing HTTP to HTTPS and redirecting specific sub-page visitors to different URL

Forcing HTTP to HTTPS and redirecting specific sub-page visitors to different URL

(OP)
Can someone please advise on the following ...

Currently all 'top-level' HTTP visitors are forced to HTTPS by means of an entry in the .htaccess file, like this:

[root]# more .htaccess
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

In addition to this, I would like visitors to specific subpages to be redirected to a completely different server.

For example:
http://this_server.com/path/here/visitors

should be re-direted here:
https://another_server.fr/some/new/path/guests

Thanks for any help
Best regards



RE: Forcing HTTP to HTTPS and redirecting specific sub-page visitors to different URL

In your htaccess fil try:

CODE

Redirect /path/here/visitors https://destinationserver/path 

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech

RE: Forcing HTTP to HTTPS and redirecting specific sub-page visitors to different URL

(OP)
Many thanks,

I tried this to no avail; I restarted Apache and cleared the cache on the browser.

Should I try with the full server path?

Best regards

RE: Forcing HTTP to HTTPS and redirecting specific sub-page visitors to different URL

You can try with the full server, but it should not matter. Is the directory your .htaccess is in set for AllowOverride All in your apache configuration? That is are you sure Apache is reading your htaccess file?

The easiest way to make sure is to cause an error.
Just type anything you want in the htaccess file like "thisisareadingtest". If the file is being read, your browser will show an Internal Server Error Message. And you'll get an error in the Apache logs along the lines of: ".htaccess: Invalid command thisisareadingtest ..."

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech

RE: Forcing HTTP to HTTPS and redirecting specific sub-page visitors to different URL

(OP)
... many thanks, you were absolutely right it was the Apache setting.

Many thanks for all your help.

RE: Forcing HTTP to HTTPS and redirecting specific sub-page visitors to different URL

You're welcome.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close