Rewrite and redirect issues after I get SSL certificates

0

Hello! I am having problems with redirects after I have contracted two SSL certificates through Locaweb and am not experienced in configuring the web.config file. Since I did not get help from them (and they probably were not even in the mood to help me), I'm choosing to get help here.

I have my domain www.dsaportfolio.com.br and a subdomain blog.dsaportfolio.com.br (created by the Locaweb panel and pointing to the directory "blog"), both with sites in production stage. I recently contracted two SSL certificates for Locaweb, one for the domain and one for the subdomain, since I host it there and they do not offer SSL wildcard (which I found in other providers and I found the price expensive). Before that I had already set up some rewrites in web.config to test some of my clients' sites that use "friendly" URLs. However, after I hired SSL, I started trying to make web.config force the use of "https". With the main domain, I was able to work with the following rule:

<rule name="Https" stopProcessing="true">
  <match url=".*" ignoreCase="true" />
    <conditions>
       <add input="{HTTPS}" pattern="off" ignoreCase="true" />
    </conditions>
    <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="true" />
</rule>

But it does not work for the subdomain. I tried other rules for this, but I did not succeed ...

Incidentally, the subdomain worked with "http", and now only works with "https".

I also tested other rewrite rules that already existed and were working, but now do not work, resulting in the following message: " Connect failed: No connection could be made because the target machine actually refused it. "

An example rewrite rule I have in web.config that has stopped working:

<rule name="CVQ - Conteudo" stopProcessing="true">
  <match url="^([\/]{0,1}clientes\/corpovida_quiro\/)([\w\%]+)$" ignoreCase="true" />
    <conditions>
      <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
      <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
    </conditions>
  <action type="Rewrite" url="clientes/corpovida_quiro/cont.php?n={R:2}" appendQueryString="false" />
</rule>

In short:

  • I need to make the http redirect permanently to https, regardless of the URL structure (with or without www) for both the dsaportfolio.com.br domain and the blog subdomain. dsaportfolio.com.br ;
  • I need the rewrite rules to continue to work, regardless of whether you are using http or https, and again for both the dsaportfolio.com.br domain and the blog.dsaportfolio.com subdomain. br ;
  • An additional item that may be a dumb question: whether web.config works for either the domain or the subdomain, or if I have to create a second web.config within the subdomain directory.
  • I have done a lot of research on the internet, tried several things and I can not solve this. I do not even want to ask for help for Locaweb because, as stated before, it seems that they do not know or want to help me with this. Every help is welcome. Thanks!

    NOTE: The blog in question stores a website in Wordpress. It may be helpful for you to know that.

        
    asked by anonymous 08.05.2018 / 19:33

    0 answers