Forum Replies Created

Viewing 2 replies - 106 through 107 (of 107 total)
  • Plugin Author Team Staatic

    (@staatic)

    We have just released an update of the plugin (v1.2.2) which adds a new filter hook staatic_netlify_config_extra. This can be used to inject additional configuration to the netlify toml file.

    This does require some code, but can be easily achieved by adding the following to your theme’s functions.php file or by creating a file in the mu-plugins folder, e.g. staatic_netlify.php:

    
    add_filter('staatic_netlify_config_extra', function ($extraConfig) {
        return $extraConfig . <<<EOD
    # extra domain-level redirects
    
    [[redirects]]
    from = "https://myapp.netlify.app/*"
    to = "https://myapp.com/:splat"
    status = 301
    force = true
    
    [[redirects]]
    from = "https://myapp.netlify.app/*"
    to = "https://myapp.com/:splat"
    status = 301
    force = true
    
    EOD;
    });
    

    Please let me know if this solution works well for you.

    • This reply was modified 2 years, 7 months ago by Team Staatic.
    • This reply was modified 2 years, 7 months ago by Team Staatic. Reason: Fix code formatting
    • This reply was modified 2 years, 7 months ago by Team Staatic. Reason: Fix code formatting
    • This reply was modified 2 years, 7 months ago by Team Staatic. Reason: Fix code formatting
    Plugin Author Team Staatic

    (@staatic)

    Hi @razakhadim, first of all thanks for using Staatic!

    Regarding your request, what you are trying to achieve appears to be related to Netlify’s domain-level redirects functionality (https://docs.netlify.com/routing/redirects/redirect-options/#domain-level-redirects) allowing you to redirect all traffic from your site’s netlify.app domain to your custom domain, is that correct?

    This is currently not supported using the “Additional Redirects” setting since such redirects are expected to have the same origin as the static site and are therefore path-based. It would still make sense to support this use case though, so we will have to think what the best approach to achieve this would be.

    If you can confirm whether I understand your request correctly, I will discuss this with the team and we can see if we can find a way to make this use case possible in a future release of the plugin.

Viewing 2 replies - 106 through 107 (of 107 total)