× Here you can get community support related to ReDJ.

Redirect to http and https

  • nunonog
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 7 months ago #3894 by nunonog
Redirect to http and https was created by nunonog
Hi,
I want to redirect all pages of my site to http, except some specific to https.
Is it possible to do this using Redj?
I have the certificate of course and have set global config to https to the entire site.
I'm on J2.5.
Thank you

Please Log in or Create an account to join the conversation.

More
9 years 7 months ago #3896 by admin
Replied by admin on topic Redirect to http and https
Hi,
it could be possible with ReDJ but if you just need it only for this, maybe it is better to use a .htaccess rewrite rule.

Kind regards

Please Log in or Create an account to join the conversation.

  • nunonog
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 6 months ago #3897 by nunonog
Replied by nunonog on topic Redirect to http and https
Thank you so much!

I tried it and managed to get all the pages redirected to http with:

RewriteEngine On
##Redirecionar para https - apenas algumas páginas
RewriteBase /

# Turn SSL on for /page1
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} ^/page1
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

# Turn SSL off everything but /page1
RewriteCond %{HTTPS} on

RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]

It is working OK, except for the part of redirecting to https the page /page1.
With the code above, when /page1 is loaded it is redirecting to /index.php

Do you know what I'm doing wrong?
Thanks in advance for any help!

Please Log in or Create an account to join the conversation.

More
9 years 6 months ago #3898 by admin
Replied by admin on topic Redirect to http and https
Hi,
at the first sight it seems all ok. You can try to enable logging:
RewriteLog /path/to/rewrite.log
RewriteLogLevel 9

Kind regards

Please Log in or Create an account to join the conversation.

Time to create page: 0.131 seconds