vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Forum and Server Management (https://vborg.vbsupport.ru/forumdisplay.php?f=232)
-   -   Windows Server https:// redirect (https://vborg.vbsupport.ru/showthread.php?t=324289)

RichieBoy67 01-25-2017 08:02 PM

Windows Server https:// redirect
 
I have the code below to redirect to https://www using web.config. Is this correct?

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="Redirect to https" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://www{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

Also, how do I add this to the config? It already has <handlers></handlers>.. I just paste it in there above <system.webServer>
Thanks,
Rich

AWS 01-26-2017 10:13 AM

You have a couple errors.

Code:

                <rule name="http to https" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTPS}" pattern="^OFF$" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
                </rule>

Set canonical domain for www like this.

Code:

                <rule name="CanonicalHostNameRule1">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^www\.yourdomain\.com$" negate="true" />
                    </conditions>
                    <action type="Redirect" url="http://www.yourdomain.com/{R:1}" />
                </rule>


Dr.CustUmz 01-29-2017 10:36 AM

try my product =)
https://vborg.vbsupport.ru/showthread.php?t=322433

Stratis 01-29-2017 12:28 PM

Quote:

Originally Posted by Dr.CustUmz (Post 2581481)

Ryan, does it work in vb4.2xx ?
Thanks

Dr.CustUmz 01-29-2017 09:05 PM

there's no reason it shouldn't give it a shot and let me know, there are no settings for it. it is simply a plugin at the init_startup hook redirecting from http to https, if you do not already have https set up prior to installing it will not work.

PHP Code:

if(empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "off"){
    
$redirect 'https://' $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    
header('HTTP/1.1 301 Moved Permanently');
    
header('Location: ' $redirect); 


DivisionByZero 01-30-2017 06:30 PM

redirects should ALWAYS be done at the server level!

RichieBoy67 01-30-2017 06:32 PM

Quote:

Originally Posted by DivisionByZero (Post 2581545)
redirects should ALWAYS be done at the server level!

#1 - I only have access to the forum and forum directory, not the root

#2 - Only the forum needs to be switched to https://

DivisionByZero 01-30-2017 06:34 PM

.htaccess or web.config suffices as server-level config, per-directory too.

RichieBoy67 01-30-2017 06:37 PM

Thanks, but I know this much already. lol That is what I was trying to figure out. How to do the https:// in the web.config.. I think I got it now anyways but thanks much.

DivisionByZero 01-30-2017 06:38 PM

ok. let me know if it doesn't work. i use windows server myself and have it setup somewhere.


All times are GMT. The time now is 01:30 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01076 seconds
  • Memory Usage 1,738KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete