0

We're switching the theme on our site to one that's more mobile-first but I'm having some issues with the redirect. Our current site settings have the wordpress address (URL) as: https://wnyskydiving.com/wordpress and the site address (URL) as: https://wnyskydiving.com/ which works fine.

We set up our web.config file to redirect everything to the https site:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.web>
    <trust level="Full" />
  </system.web>
  <system.webServer>
    <!-- Set the default document -->
    <defaultDocument>
      <files>
        <remove value="index.php" />
        <add value="index.php" />
      </files>
    </defaultDocument>
    <directoryBrowse enabled="false" />
    <rewrite>
      <rules>
            <rule name="WordPress: http://wnyskydiving.com/" patternSyntax="Wildcard">
                <match url="*" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                <action type="Rewrite" url="index.php" />
            </rule>
                <rule name="Redirect to https" stopProcessing="true">
                    <match url=".*" />
                    <conditions>
                        <add input="{HTTPS}" pattern="off" />
                    </conditions>
                    <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" />
                </rule></rules>
    </rewrite>
  </system.webServer>
</configuration>

The problem is...I set up our development site in a 'test2' folder and it works fine for the home page: https://wnyskydiving.com/test2/ But, as soon as I try to use the menu or navigate to a full path URL on the dev site, it redirects me to the live site and I can't see my dev pages to be able to work on them. https://wnyskydiving.com/test2/tandem-skydiving/ redirects to: https://wnyskydiving.com/tandem-skydiving/

How do I get around this?? Thanks in advance!!

  • 1
    I take it both installs are using the same database? – Tom J Nowell Apr 25 '18 at 18:42
  • I've actually got the dev site using a different database so that any changes I make aren't reflected on the live site. I started with a copy of the live database but it is using a different database entirely. – Brian Apr 26 '18 at 11:39
  • Did you do a search replace for the URL? – Tom J Nowell Apr 26 '18 at 17:13
  • Would I do that in the database? It seems like it's a redirect issue on the site since I can enter the complete URL and it dynamically changes it in the browser to go to the live site. – Brian Apr 26 '18 at 18:32
  • Yes, if your HTAccess redirected, then WP would redirect back and you'd end up in a neverending loop anyway. Don't rely on HTAccess to do rewriting, WP has its own system, the HTAccess rules it adds to begin with are just to pass all URLs to index.php. Likewise with Nginx or IIS ( it looks like you're using IIS or some other less common server ) – Tom J Nowell Apr 26 '18 at 18:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.