Can not reach admin login page after installation (404 Not Found)


#1

Hello,

I am new to SilverStripe, but I am trying to solve this issue for a few hours now and have no idea what to do.

Simply, I can’t reach admin login page (after successful installation of SilverStripe on my server). When I click on “CMS” on default page, I’ve got redirected to /silverstripe/public/admin/ on my server but it shows 404 Error with “The requested URL /silverstripe/public/admin/ was not found on this server.”

Can someone please help?


#2

Hi @Viktoria_S, that URL doesn’t look right. Can you try accessing just ‘/admin’ instead?


#3

Thank you for your reply,

Same thing - “The requested URL /admin was not found on this server.”

When I get into directory where “admin” is supposed to be (one from redirect - /silverstripe/public/admin), there is no “admin”, obviously. But I do not know how to redirect it to directory where the admin is as well as I don’t know where the admin is… probably this is something really easy to solve, but I have no idea…

I didn’t really find anyone with same issue with default page.


#4

It sounds like a problem with url rewriting, but you said it installed successfully… There weren’t any warnings when you installed SilverStripe? You may still be available to visit /install.php - can you check there’s no warning about friendly URLs?

Do you have a .htaccess file in the root of your website and does it contain SilverStripe directives?


#5

Actually it sounds like you might have tried to set up a SilverStripe site in a ‘silverstripe’ sub directory within your web root? Ideally you would have a directory for your project (where SilverStripe is installed), and beneath that you would have a ‘public’ sub directory which should be configured to be your web root. But if you can’t do that (i.e. using restrictive/shared hosting) then SilverStripe should be installed directly in to the web root. So directly inside your web root you would end up with directories named ‘app’, ‘vendor’ and ‘assets’.


#6

I am not sure if I understand. Now SilverStripe is installed in /var/www/html/silverstripe/public, but I didn’t choose where I want to install it. How can I choose it? Or what did you mean by installing directory into the web root?

During the installation, I’ve got a message about ‘Friendly URLs are not working…’ but then it installed successfully. Maybe that’s the issue, I don’t know. Do you know how to fix this?

I can show you what .htaccess file contains:

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

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

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

# 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
    </IfModule>

    SetEnv HTTP_MOD_REWRITE On
    RewriteEngine On
    RewriteBase '/silverstripe/public'


    # 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.
    # Pass through the original path as a query parameter, and retain the existing parameters.
    # Try finding framework in the vendor folder first
    RewriteCond %{REQUEST_URI} ^(.*)$
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule .* index.php
</IfModule>
### SILVERSTRIPE END ###

#7

You’ll need to enable mod_rewrite in Apache for the URLs to work properly.

I’m not sure how the site ended up in ‘/var/www/html/silverstripe/public’ but you could try moving everything out of there and in to ‘/var/www/html/’, including the .htaccess file.

After that you should be able to delete the ‘/var/www/html/silverstripe/’ directory.

That’s assuming that ‘/var/www/html/’ is your web root (it usually is), and that your ‘app’, ‘vendor’ and ‘assets’ folders are inside ‘/var/www/html/silverstripe/public’ currently.

It sounds like you’re installing SilverStripe to a remote server? If you’re just getting started with SilverStripe it’s probably going to be easier to learn if you develop locally. Usually developers will build a website and any updates on their own computer first, and only publish them to a remote server after they’re complete. This ensures you have multiple copies of the website code around for redundancy, and ensures visitors don’t arrive at your website in a half-finished state. If you’re on a Mac, this is a good resource for getting a local development environment set up: macOS 10.14 Mojave Apache Setup: Multiple PHP Versions | Grav


#9

Well, mod_rewrite is enabled. At least, after

a2enmod rewrite

I’ve got

Module rewrite already enabled

And if I move everything into /var/www/html, it is going to continue to redirect it into /silverstripe/public/admin/, isn’t it?

Yes I do, but this is actually part of my homework, I can’t really decide where I will install Silverstripe, it has to be on that server.


#11

Sorry I’m out of ideas :slightly_frowning_face: hard to troubleshoot these issues from outside. It sounds like a server configuration issue rather than a SilverStripe problem but I know that’s not particularly helpful!


#12

No worries, Thank You very much for your help anyway! :slight_smile: