Skip to content

Another 404 issue - apologies

edited October 17 in Troubleshooting

I'm using Joomla 5 on a Windows server 2022 and IIS10, but Sendy doesn't work correctly when moving to a different page. If I manually add .php to the end of the page URL it displays correctly.
The .htaccess file is present in the sendy folder and I've followed the instructions to add RewriteBase /sendy after RewriteEngine On but it has no effect.
Is anyone else using sendy on a Joomla site and knows of a fix to this issue?

Comments

  • BenBen
    edited October 17

    Hi,

    The cause is that IIS ignores .htaccess files, so the RewriteBase /sendy edit does nothing. .htaccess is an Apache feature. Sendy's clean URLs (like /sendy/subscribers instead of /sendy/subscribers.php) depend on those rewrite rules, which is why adding .php by hand works.

    On IIS you need the same rules in a web.config file, using the URL Rewrite module.

    1. Install the IIS URL Rewrite module if it isn't installed (Microsoft's free add-on, via Web Platform Installer or the IIS downloads page).
    2. Open IIS Manager, select the site or the sendy folder, and open URL Rewrite.
    3. Click Import Rules on the right. Point it at Sendy's .htaccess file and click Import. IIS converts the Apache rules to web.config format automatically. Click Apply.
    4. If the import leaves any rule untranslated, a manual version of the main rule looks like this. Put it in /sendy/web.config:
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
      <system.webServer>
        <rewrite>
          <rules>
            <rule name="Sendy add php" stopProcessing="true">
              <match url="^(.*)$" />
              <conditions>
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                <add input="{REQUEST_FILENAME}.php" matchType="IsFile" />
              </conditions>
              <action type="Rewrite" url="{R:1}.php" />
            </rule>
          </rules>
        </rewrite>
      </system.webServer>
    </configuration>
    

    Sendy's .htaccess also has rules for tracking and subscribe links (/l/, /t/, /w/, /subscribe/, /unsubscribe/). Those need translating as well, which is why the Import Rules route is safer than the hand-written version.

    One more thing to check. Joomla's own web.config (or root rewrite rules) can catch requests before Sendy sees them. If the 404 persists, make sure Sendy is in its own subfolder with its own web.config, and that the Joomla rules exclude the /sendy path. The usual way is a condition like {REQUEST_URI} doesn't match ^/sendy.

This discussion has been closed.