We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

Link IIS root folder with local xampp wordpressRSS

9 replies

Last post Mar 12, 2021 12:20 AM by lextm

  • Link IIS root folder with local xampp wordpress

    Mar 08, 2021 10:21 AM|EcoIt|LINK

    Hi there!

    I'm using IIS 6.2 in a local server with different domains that points to a different local server folders that shows different websites (based on asp and html files). That's working fine, but now I would like to change one of these websites for a wordpress.

    To do that i've installed wordpress using xampp into another local server. That's working fine and I can access from the iis server to the wordpress server doing something like wordpresslocalip:8080

    What I would like to do it's to point one of the domains that it's currently on the IIS to the wordpress web so when someone tips the domain www.example.com the wordpress web will be showed instead the current asp file. Also I nedd to this only affects to the root document, not to others, example:

    www.example.com -> redirected to wordpress.

    www.example/test/welcome -> not redirected.

    Is there any way to achieve this with url redirection or changing the web.config file?

    Thanks a lot!

  • Re: Link IIS root folder with local xampp wordpress

    Mar 09, 2021 02:47 AM|samwu|LINK

    Hi Ecolt,

    EcoIt

    www.example.com -> redirected to wordpress.

    www.example/test/welcome -> not redirected.

    You only need to create a url rewrite rule to meet these two conditions. here a link about the use of url rewrite module you can use as a reference: Creating Rewrite Rules for the URL Rewrite Module.

    If you still can't solve the question, please post details information about question, i will make demo for you.

    Best regards,

    Sam

    IIS.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today. Learn more >
  • Re: Link IIS root folder with local xampp wordpress

    Mar 09, 2021 09:26 AM|EcoIt|LINK

    Hi samwu, thanks for the answer.

    I've tested with this rule but it's doing nothing

     <rule name="redirect" stopProcessing="true">
                    <match url="^$" />
                        <conditions logicalGrouping="MatchAny">
                            <add input="{HTTPS}" pattern="on" />
                          <add input="{HTTP_HOST}" pattern="^http://myweb.com$" />
                        </conditions>
                      <action type="Redirect" url="http://192.168.100.10:8080/" />
    </rule>

    Can you help me? what i'm doing wrong? I just need to myweb.com shows website that it's on the internal ip 192.168... but still showing myweb.com in the browser.

    thanks!

  • Re: Link IIS root folder with local xampp wordpress

    Mar 09, 2021 11:28 AM|EcoIt|LINK

    I think what I need it's a reverse proxy? https://ruslany.net/2009/04/10-url-rewriting-tips-and-tricks/ point 7? 

  • Re: Link IIS root folder with local xampp wordpress

    Mar 10, 2021 07:45 AM|samwu|LINK

    Hi Ecolt,

    EcoIt

    you help me? what i'm doing wrong? I just need to myweb.com shows website that it's on the internal ip 192.168... but still showing myweb.com in the browser.

    Do you want to redirect from http://myweb.com/page1.html to http://192.168.100.10:8080? if so, you can try this rule:

    <rule name="redirect" stopProcessing="true">
      <match url="^page1.html$" />
        <conditions>
          <add input="{HTTP_HOST}" pattern="http://myweb.com" />
        </conditions>
      <action type="Redirect" url="http://192.168.100.10:8080" />
    </rule>

    Best regards,

    Sam

    IIS.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today. Learn more >
  • Re: Link IIS root folder with local xampp wordpress

    Mar 10, 2021 07:54 AM|EcoIt|LINK

    Hi samwu,

    I've been able to do it using this rule, but it's only works for the mainpage, once i'm on the wordpress and I press any other menu, it goes to the original domain 192.168.100.10:8080/newmenu

     <rule name="Proxy">
    <match url="(.*)" />
    <action type="Rewrite" url="http://192.168.100.10:8080/{R:1}" />
    </rule>

    Is there any way to keep always original domain and not only for the main page?

    Thanks!

  • Re: Link IIS root folder with local xampp wordpress

    Mar 10, 2021 09:11 AM|samwu|LINK

    Hi Ecolt,

    EcoIt

    Is there any way to keep always original domain and not only for the main page?

    According to your description, I couldn’t understand your requirement clearly.

    Can you explain your question in detail?

    Best regards,

    Sam

    IIS.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today. Learn more >
  • Re: Link IIS root folder with local xampp wordpress

    Mar 10, 2021 09:22 AM|EcoIt|LINK

    Hi samwu, i'll try to explain it better.

    I have a site (example.com) with some folders and subfolders with asp and html files inside, something like this:

    example.com

    root -> homepage.asp 

                  -> folder1 -> index2.asp

                  -> folder2 -> page3.asp

    I have created a wordpress site on other server in the network 10.34.100.10:8080.

    I do need to once you go to example.com it would be redirected to 10.34.100:10:8080 but keeping example.com domain and once you are in the wordpress it keeps the example.com url, for example once i'm in the wordpress if I go to other site inside the wordpress it should keep example.com, for example if I click on 'blog' it should show 'example.com/blog'

    I've been able to achieve this, with the following code but still have a problem, I do need that if someone goes to any of the original root folders it would not be redirected to the 192.168.100.10, so I need to the redirection only works into the root and not for the subfolders.

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <defaultDocument>
                <files>
                    <add value="homepage.asp" />
                </files>
            </defaultDocument>
            <rewrite>
                <rules>
                    <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                          <match url="^$" />

                        <action type="Rewrite" url="http://192.168.100.10:8080/{R:1}" />
                    </rule>
                </rules>
                <outboundRules>
                    <rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
                        <match filterByTags="A, Form, Img" pattern="^http(s)?://192.168.100.10:8080/(.*)" />
                        <action type="Rewrite" value="http{R:1}://example.com/{R:2}" />
                    </rule>
                    <preConditions>
                        <preCondition name="ResponseIsHtml1">
                            <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
                        </preCondition>
                    </preConditions>
                </outboundRules>
            </rewrite>
          
        </system.webServer>
    </configuration>

  • Re: Link IIS root folder with local xampp wordpress

    Mar 11, 2021 09:36 AM|samwu|LINK

    Hi Ecolt,

    EcoIt

    I've been able to achieve this, with the following code but still have a problem, I do need that if someone goes to any of the original root folders it would not be redirected to the 192.168.100.10, so I need to the redirection only works into the root and not for the subfolders.

    You can use parameters in the rule to restrict, let it only works into the root and not for the subfolders.

    For example, in your rule "^$" only matches empty, but you can use specific parameters to make it match only the root.

    Best regards,

    Sam

    IIS.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today. Learn more >
  • Re: Link IIS root folder with local xampp wordpress

    Mar 12, 2021 12:20 AM|lextm|LINK

    EcoIt

    I've tested with this rule but it's doing nothing

     <rule name="redirect" stopProcessing="true">
                    <match url="^$" />
                        <conditions logicalGrouping="MatchAny">
                            <add input="{HTTPS}" pattern="on" />
                            <add input="{HTTP_HOST}" pattern="^http://myweb.com$" />
                        </conditions>
                        <action type="Redirect" url="http://192.168.100.10:8080/" />
                    </rule>

    Mistake 1 in The Very Common Mistakes When Using IIS URL Rewrite Module – The Half-Blood Programmer – Stories from Lex Li on technologies. (lextudio.com)

    If your goal is to issue 30x redirection responses, you don't need to set up a reverse proxy.

    Lex Li
    Want to have a chat on the issues you meet? Book an appointment at https://buy.stripe.com/cN24ia0yi7sAdIA7sv
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.