CSS of Admin page not showing up

The main page is fine. But the admin styling is not showing up.

When i open this at a browser, it says not found. But i checked the file, it exists. sampledomian.com/vendor/silverstripe/admin/client/dist/styles/bundle.css?m=160222414

Admin page also says Unsupported browser, evenn thought i am using chrome.

1 Like

I had a similar issue on a site just recently. I still don’t know quite what the underlying cause was, but deleting the vendor directory completely and running a composer install cleared it up.

Is this an SS4 project and are you using the public folder? You could try running composer vendor-expose.

yes. is is a ss4. i already tried composer vendor-expose. i am also using public folder. but still the css layout for admin page is not showing.

Check you have an .htaccess in the public directory and one in the public folders parent (project root)

i have .htaccess on root and public.

i find the problem. the .htaccess of my public folder has

Deny access to potentially sensitive files and folders

RewriteRule ^vendor(/|$) - [F,L,NC]

i remove
RewriteRule ^vendor(/|$) - [F,L,NC]

is what i have done, okay?

@Jerome_Tan no you wouldn’t want to do that.

What version are you using? I checked a 4.6.1 install I have and this is the .htaccess file contents for the file in /public


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


The content of the .htaccess file in the root is:

RewriteEngine On
RewriteRule ^(.*)$ public/$1

i am using 4.3. but i think 4.6.1 htaccess is the one i used. i am not really sure.

Can you post your composer.json file? I wonder if you could have mis-matched cms and framework versions.

Using a .htaccess file from a different version of SS could cause issues.

Assuming it’s safe to experiment (you have source control set up etc.) I would try making these changes to your composer.json file:

  1. Change “silverstripe/recipe-cms”: “4.3.3@stable” to “silverstripe/recipe-cms”: “^4.6”
  2. Delete the “app/.htaccess”, line from the “extra” section
  3. Delete the whole “public-files-installed” section

Then run composer update and see what happens. It should hopefully upgrade you to the latest stable version of Silverstripe, and reset your htaccess files.

here is my composer.json

Blockquote
{
“name”: “silverstripe/installer”,
“type”: “silverstripe-recipe”,
“description”: “The SilverStripe Framework Installer”,
“require”: {
“php”: “>=5.6.0”,
“silverstripe/recipe-plugin”: “^1.2”,
“silverstripe/recipe-cms”: “4.3.3@stable”,
“silverstripe-themes/simple”: “~3.2.0”,
“bummzack/sortablefile”: “^2.0”,
“undefinedoffset/sortablegridfield”: “^2.0”,
“unclecheese/betterbuttons”: “dev-feature/ss4-upgrade”,
“phpmailer/phpmailer”: “^6.0”,
“gargron/fileupload”: “~1.4.0”
},
“require-dev”: {
“phpunit/phpunit”: “^5.7”
},
“extra”: {
“project-files-installed”: [
“app/.htaccess”,
“app/_config.php”,
“app/_config/mysite.yml”,
“app/src/Page.php”,
“app/src/PageController.php”
],
“public-files-installed”: [
“.htaccess”,
“index.php”,
“install-frameworkmissing.html”,
“install.php”,
“web.config”
],
“expose”: [
“themes/main/assets”,
“themes/main/css”,
“themes/main/fonts”,
“themes/main/images”,
“themes/main/js”,
“themes/main/templates”

    ]
},
"config": {
    "process-timeout": 600
},
"prefer-stable": true,
"minimum-stability": "dev"

}

I had this exact problem. It turned out that the dist folder was like a broken symlink or not uploaded correctly. I had to reinstall the Silverstripe Framework to fix it.

I also had this problem. Thank you for guiding us

I have the same problem when I was downloading the Silverstripe 4.9 through composer command and executing this command code vendor/bin/sake dev/build on the termenal after the dev/build process then I browsed my-site the CSS and Javascript did not rendered properly – Aaaarrgghh!.

What I did. I run the composer expose and composer update still didnt work. I also deleted the vendor folder and run the composer install and now i am getting a problem Autoloading is missing. However, I decided to redownload the SS4.9 and configuring properly the .env fle and then run the dev/build on the browser instead on the terminal. Finally, its work amazing!.. So i move my project into public instead using the Theme.

Hope this helps!. Enjoy your coding!

Cheers!