Sonata admin missing css files - sonata-admin

Working on a site with php 7.2, Symfony 4 and Sonata admin 3.
In dev, on my machine, everything works fine, the site itself, and the two admins (user and content).
I have put everything on the final server (unfortunately, file by file, no console with S4 ! so, no "composer:install"...).
Still on dev, the site works fine, all functionalities.
But when I try to use the admin page, I only get a non-formatted page. None of the assets (css and js) seems to work!
However the source code are identical, on localhost and the distant site...
Can anyone help me
Edit : I found where the issue comes from : it's linked to .htaccess.
The http address I use ends in /public/index.php. I use .htaccess to shorten it and when using the .htacces redirection I can't get the assets of the admin page, while it works fine without redirection.
Is there something I should change in my .htaccess code ?
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ public/index.php
</IfModule>

Related

url is not working in live but working fine at local for cakephp project

I am using cake php version 2.4. My project is running well in my local machine and it is a simple test project. I uploaded it in live. It does not work in live and even all css file are not loading. Should I change any server configuration?
You should check below situation in your Online Server :
DocumentRoot is properly set
Example : DocumentRoot /cake_install/app/webroot
.htaccess file is configured properly.
webroot Directory have the correct permissions
Check all other file/folder permissions
Ensure apache rewrite module is on
Note : rewrite module should be enabled from your online server for CakePHP URLs
I used the following code in .htaccess file where app folder is located:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
Now it works for me.

How can I setup my .htaccess file to route to https:// in an angular app?

I've seen some related access but they seem to affect the routes themselves. Shouldn't I just be able to update the initial load to be https and then everything else would flow from there?
My site is setup like this:
/Root
*client
-app files
-index.html
-htaccess
*server
-server.js (express, node)
In the .htaccess file. I have:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
What am I doing wrong? The .htaccess file apparently has no result? I want it to redirect to https:// when a user visits www., the root domain, or http://
Thank you for any help. Much appreciated.
Update: I've found another post that says this should work for me:
##Force SSL
#Normal way (in case you need to deploy to NON-heroku)
RewriteCond %{HTTPS} !=on
#Heroku way
RewriteCond %{HTTP:X-Forwarded-Proto} !https
#If neither above conditions are met, redirect to https
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Unfortunately, it does not. Here is the post: How to redirect to HTTPS with .htaccess on Heroku Cedar stack
Apache redirection (using .htaccess) using a node server doesn't seem to work well together.
Stop Apache. Integrate redirection within your node express server file. Restart as a node server (sudo node server).

ImpressPages admin page has 404 error

I have just installed ImpressPages 4_0_17 and I completed the installation process through the point of filling out the database form and submitting it. The next page gave a 404 error on the URL /ImpressPages/admin. Prior to that, the systems check page listed 3 warnings: Magic quotes Off, Apache mod_rewrite, PHP memory limit 64MB. No other info on these warnings was available on that page.
I am using the alias feature on GoDaddy for hosting, which allows me to create multiple websites in the same account. In addition, I am using a sub-domain for this install so I can test it out before replacing the original site. Because I uploaded the entire IP zip file and extracted it in the web root folder, all the IP files are now installed in the folder /ImpressPages.
After the 404 error, I altered the URL to be just /ImpressPages/. That actually loaded fine. In addition, a small dialog popped up saying that I had been automatically logged in as admin. It gave me the username, password and the email I configured for the site. It also provided the admin page URL that produces a 404 error and said I needed to go there to login in the future.
The home page at /ImpressPages/ loads and shows inline editing features. If I click the Lorem Ipsum link, /ImpressPages/index.php/lorem-ipsumy, I get a white page with the one line:
"No input file specified."
I have tried a few tweaks to the .htaccess file with no success. The latest active lines are shown below. All the other lines from the default file are commented out and I have not tried messing with them.
<IfModule mod_rewrite.c>
RewriteEngine on
# Attempt to fix SVG images, 6/4/2014
AddType image/svg+xml svg
AddType image/svg+xml svgz
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /ImpressPages/index.php?%{QUERY_STRING} [L]
# Redirect www urls to non-www.
# RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
# RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
</IfModule>
The changes I attempted to get admin access are in the RewriteRule. I prefixed index.php first with a slash, then with /ImpressPages/. Neither one helped. Any suggestions on how to get admin access will be greatly appreciated.
17:11 - New info:
With the /ImpressPages/ path and the following .htaccess lines enabled, I can now get the login dialog on the admin page. Once I enter the login correctly, the next URL is /ImpressPages/index.php with the white page described previously. Then reloading /ImpressPages/admin produces the same white page and the same /ImpressPages/index.php URL. So now I can login, but it doesn't help.
Options -Indexes
Options -MultiViews
Those lines are in the default .htaccess file already. I just removed the comment character to activate them.
17:45 - more progress.
I moved all the contents of the /ImpressPages/ folder up one level to web root. Then I removed /ImpressPages/ from the path for index.php in the rewrite rule. With that one change, admin login started working and I am now able to edit my site. There are still issues. For example, publishing a page does publish the changes, but then loads the typical white page with the URL /index.php/home. The URL / loads the home page correctly. Almost sounds like the URL routing is not working correctly.
It looks like ImpressPages instal decided your server doesn't support URL rewrites and has placed rewritesDisabled in config.php
Try to remove this config line.

Cakephp not loading css and js files

I seriously can't understand what is going on here. I just uploaded my web app from localhost to new domain-name on Windows IIS Server. When I try to access the web app, CSS files and images are not loaded and I get the following error:
"CssController could not be found."
I don't understand why it is doing this.
Although I've written code like this in my default.ctp:
echo $this->html->css('generic');
CSS files are placed in:
app\webroot\css
I have searched on Google and have tried everything, I even uncommented the line:
Configure::write('App.baseUrl',env('SCRIPT_NAME')); in core.php
But I still cannot get this to work. Please help me to resolve this issue.
Double check that you have all the .htaccess files in place.
Also making sure /app/webroot/ has its .htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
Your request is trying to get the css file from /css/ but i'm thinking you don't have the proper .htaccess files in place to route it to the webroot and not to a controller!
also check if mod_rewrite is enabled
Edit: and then I saw the IIS part, you need some IIS equivalent to mod_rewrite
In this article you find all the information required for successfully run CakePHP web applications under Microsoft IIS web server: http://bakery.cakephp.org/articles/filippo.toso/2008/01/29/cakephp-on-iis
Here is a related question about getting cake to work on IIS: CakePHP 2.2.2 not working on Windows IIS7

Setup subdomain in new app directory with Cpanel cakephp

I have working domain.kz with cakephp (Cpanel hosting)
www/app
www/cake
www/index.php
how can i setup admin.domain.kz to (app2)
www/app
www/app2
www/cake
www/index.php
The way you want it - will be very difficult; you'll have to change several file/folder paths in several places. Instead, why don't you try to create an admin folder where you've the full cakephp application for admin.
So the resulting folder structure would be like this:
(domain.kz)
www/app
www/cake
www/index.php
(admin.domain.kz)
www/admin/app
www/admin/cake
www/admin/index.php
Then you'll have to point your subdomain (admin.domain.kz) to /www/admin.
Now assuming that you've configured your domain and subdomain correctly, if you try to browse your domain, it'll work with no issues but if you try to access your subdomain, it'll give you a 500 error. DON'T WORRY. It is expected.
The primary .htaccess file is forcing all requests served by primary webroot (www/app/webroot) folder. You'll have to change your primary .htaccess file (www/.htaccess) like this:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^admin\.domain\.kz$ [NC]
RewriteRule ^ - [L]
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
Notice that, I've added two lines which tells that if you're trying to access your subdomain, stop rewriting; otherwise rewrite as usual. Cheers!!!
If the cake apps are totally separate but share a cake library then the following might work:
You could use cPanel's 'Addon Domain' feature, once the DNS has been set up for admin.domain.kz. Instructions can be found here.
Set the document root of the addon domain to the www/app2 folder.
Then just make sure that CAKE_CORE_INCLUDE_PATH in www/app2/webroot/index.php points to ../../../cake

Resources