Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

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

Status
Not open for further replies.

bazil2

Technical User
Feb 15, 2010
148
DE
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 ^/?(.*) [R,L]

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

For example:

should be re-direted here:

Thanks for any help
Best regards
 
In your htaccess fil try:
Code:
Redirect /path/here/visitors [URL unfurl="true"]https://destinationserver/path[/URL]

----------------------------------
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
 
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
 
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
 
... many thanks, you were absolutely right it was the Apache setting.

Many thanks for all your help.
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top