Search code examples
apache.htaccess

Infinite address nesting


How to move through .htaccess from such addresses:

/one/two/thre/four/five/.../.../.../

There can be any characters and nesting after /.

And it turns out this crap flies out:

Not Found
The requested URL /sdfsdf/sdfsdf/sdfsdf/sdf/ was not foundon this server.

And you need to transfer to the main page, if not found.


Solution

  • The issue is resolved!
    Who needs it, I leave it here:

    <If "%{HTTPS} == 'on'">
        ErrorDocument 404 https://%{HTTP_HOST}
    </If>
    <Else>
        ErrorDocument 404 http://%{HTTP_HOST}
    </Else>