Changing to public folder - enter cms admin gives not 404 not found

Silverstripe Version:
I am in the process of changing to using the public folder and having followed the directions in the changelog for ss4.1.0 am having problems. Although the website looks fine when I try and go into admin is redirected to and I get a Page not found error.

Here are some questions that may shed some light on the issue :slight_smile:

  • What happens if you try to open admin/pages?
  • What are the redirect headers? (is it 301 or 302)
  • Do you have CDN / proxy or does it happen on your localhost?
  • What’s your public/.htaccess?

I have found that it only happens when I access using http: it is OK with https:
public/.htaccess below

# force https
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{ENV:HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

# Deny access to templates (but allow from localhost)
<Files *.ss>
Order deny,allow
Deny from all
Allow from

# Deny access to IIS configuration
<Files web.config>
Order deny,allow
Deny from all

# Deny access to YAML configuration files which might include sensitive information
<Files ~ "\.ya?ml$">
Order allow,deny
Deny from all

# Route errors to static pages automatically generated by SilverStripe
ErrorDocument 404 /assets/error-404.html
ErrorDocument 500 /assets/error-500.html

<IfModule mod_rewrite.c>

# Turn off index.php handling requests to the homepage fixes issue in apache >=2.4
<IfModule mod_dir.c>
    DirectoryIndex disabled
    DirectorySlash On

RewriteEngine On

# Enable HTTP Basic authentication workaround for PHP running in CGI mode
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Deny access to potentially sensitive files and folders
RewriteRule ^vendor(/|$) - [F,L,NC]
RewriteRule ^\.env - [F,L,NC]
RewriteRule silverstripe-cache(/|$) - [F,L,NC]
RewriteRule composer\.(json|lock) - [F,L,NC]
RewriteRule (error|silverstripe|debug)\.log - [F,L,NC]

# Process through SilverStripe if no file with the requested name exists.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.php