Magento CSS Wrong Path - css

My magento site unable to load the CSS because of wrong path. the Path is:
<link rel="stylesheet" type="text/css" href="C:\Program Files (x86)\Zend\Apache2\htdocs\myecommerce_comhttp://myecommerce.com/skin/frontend/default/theme183v2/css/reset.css" media="all" />
and the Correct path is
<link rel="stylesheet" type="text/css" href="C:\Program Files (x86)\Zend\Apache2\htdocs\myecommerce_com\skin\frontend\default\theme183v2\css\reset.css" media="all" />
I already change the value of my DB table core_config_data, cleared cache, etc..
Still not working.

It's an old question, but mostly for my own documentation:
I've had this problem. There are some things to check:
Is the folder /media/ writable? This is where Magento stores the combined js and css files.
Is the folder /var/session and /var/cache writable? Caching needs to be stored somewhere.
Just to be sure: are the tables core_cache and core_cache_tag truncated?
Making /media/ writable solved the problem for me.

Try to go to the control centre
in the System menu, in fact i think this question has been asked before
well
System => Configuration => Web
The main point to watch out for is
i. Url options -> Add store code to Urls should be 'No'
ii. Unsecure -> Base Url should point to your own domain e.g http://mycommerce.com/
iii. Secure -> Base Url should point to your own domain e.g http://mycommerce.com/
also you should have
{{unsecure_base_url}}skin/
for your Base Skin

I had the same problem but found a different solution.
Are you using an Addon like GT Speed to combine or reduce your JS and CSS files?
I uninstalled this plugin and the problem was solved for me. Hope this helps.

Related

How to include CSS in Symfony 5

I am building a Symfony 5 app and want to use CSS inside my twig templates. My stylesheet is at public/css/styles.css and so I try to use it in my twig template with the line <link href="{{ asset('css/styles.css') }}" rel="stylesheet" type="text/css"/>. This works locally but once I deploy it to the Google Cloud Platform the server can no longer find it. The console shows a 404 error when trying to find the stylesheet. Where does Symfony want me to put my css files?
This feels like it should be very simple but I'm totally at a loss and feel like I'm missing something stupid. The documentation only really talks about Encore and that seems like such overkill for using a single CSS file in a twig template.
(sorry i cant comment because low reputations, thatswhy i need to take an answer)
At first, the location of your css is correct. Also the usage of your link tag looks fine. Now the question is: what is the correct error message, or better where looks the browser to your file?
I think the browser want to take your file from root, not from public folder. If you can answer this with yes, you have to check your .htaccess file and/or linking from webspace to startfolder (public) in this cause.
It works in localhost because the symfony dev-server take this work for you.
Got the CSS working. I think what did it was telling app.yaml to put the css in the public folder.
handlers:
- url: /css
static_dir: public/css
Then instead of loading using the asset() function, I included the css with:
<link href="/css/styles.css" rel="stylesheet" type="text/css"/>
That way, the css folder I had in public locally was put in public when deployed to the GCP.

Pulling CSS and JS from base folder

I have an index file that's store on my server under a public_html folder so it can be accessed publicly.
That address is http://example.com/randomlocation/anotherlocation/index.html
on the server that would look like public_html/randomlocation/anotherlocation/index.html
The problem however is that my css, js, and img files to display the page and run it are located on another level outside of the public html section and I'm having trouble specifying the relative or base path to get there, which would be something like:
home/site/folder/randomfolder/anotherfolder/location/styles.css
For Example:
<link rel="stylesheet" href="http://example.com/randomfolder/another folder/assets/css/emojione.min.css"/>
<link rel="stylesheet" href="/home/examplesite/folder/folder/folder/folder/assets/css/styles.css" />
Doesn't seem to work. I've tried all variations of "/" relative paths and can't figure out what I'm missing to be able to pull those files.
Generally when a server has a public_html folder, the server is configured so that only files inside that folder will be accessible publicly via the web. (This way, you can have things like server configs and private files outside of public_html and people won't be able to get to them by just putting the url in their browser.)
In other words, you should move your css/js/images into public_html. You can put them in subdirectories to stay organized, but they should all be under public_html somewhere.
That is purposely not allowed as it would pose a huge security problem on the server. Take a look at this SO question for a possible work around.
php link to image file outside default web directory

easiest way to save CDN CSS resource locally?

i'm working on a bootstrap template locally on my dev server.. the template loads some resources via CDN..
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<!--font-awesome-->
<link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<!-- Ionicons -->
<link href="//code.ionicframework.com/ionicons/1.5.2/css/ionicons.min.css" rel="stylesheet" type="text/css" />
Problem is this slows me down because everytime I hit refresh to check the changes on my page (localhost) the darn thing has to load the resources online again and again..
So i tried to open the resources via the link and save em locally. but this breaks because i guess there are more things to it than just the CSS code.
Is there an easy way to "localize" these things?
Thanks guys
This are the steps I followed to use CDN CSS resource locally:
Download and extract the font pack from here
Copy the ionicons.css to your project
Copy the fonts folder to your project
Ensure the font urls within ionicons.css properly reference the fonts path within your project.
Include a reference to the ionicons.css file from every webpage you need to use it.
In my case I include this in main.html
<link href="css/ionicons.css" rel="stylesheet" type="text/css" />
then simply add the icon and icon's classname to an HTML element.
<i class="icon ion-home"></i>
and folders are in this way:
- project_name
* css --> ionicons.css
* fonts --> ionicons.eot, ionicons.svg, ionicons.ttf, ionicons.woff
To preface this answer, I'm not sure that this solution is considered 'easy' but it will get you the ability to host locally vs. being dependent on the CDNs. The easy solution is using the CDNs. That being said:
The bootstrap.min.css file is easy to localize, you can go to getbootstrap.com and get it out of the Download Bootstrap option.
Localizing Font Awesome is a bit more work. Here you need to copy the entire font-awesome directory into your project. You can download it from this URL: http://fortawesome.github.io/Font-Awesome/ . You'll end up with a directory folder named something like font-awesome-4.2.0, which will contain a series of sub-folders: css, fonts, less and scss. You'll also need to call the local font-awesome.min.css file in the head section of your HTML. See the following GitHub link for more information on setting up Font Awesome locally: http://fortawesome.github.io/Font-Awesome/get-started/
Ionicons is similar to Font Awesome setup. From the following Ionicons web page, you'll need to Download the directory and include it in your project: http://ionicons.com/ . You'll need to call the local ionicons.min.css file in the head section of your HTML after you have the directory setup.
old question, but I think there's an easy solution now:
you can install the node package by using npm install ionicons
https://www.npmjs.com/package/ionicons
Save the css/js files locally from url and change path.
eg:- css/ionicons.min.css
http://code.ionicframework.com/ionicons/1.5.2/css/ionicons.min.css
http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.1.0/css/font-awesome.min.css
http://code.ionicframework.com/ionicons/1.5.2/css/ionicons.min.css

I need to add css to my rails application in assets pipeline?

I have a rails app I put my index.html in public folder and it shows when i go to port 3000 but it doesn't show it with css, I have my css folder and i tried putting it into assets stylesheets but nothing is happing? where do i put my folder with all the css files in it? would i need to change the way my index.html referances my css files?
for now my index.html in public folder references the css files like this <link href="css/styles.css" rel="stylesheet">
i've looked into some tutorials but their a bit complex in understanding
Things put in the public folder won't be processed by the asset pipeline. This isn't the "rails way" at all, but you can just move your .css to your public folder and call it like you're calling it now.
To gain access to the asset pipeline the quickest way I can think of is to just scaffold generate something, fill in the view with your HTML and then you can call via asset pipeline. However by default the root route isn't set so you'll have to navigate to localhost:3000/whatever-controller-you-generated-here
I highly recommend reading this guide before you go much further http://guides.rubyonrails.org/
First of all if you are using rails then why are you using static page like this. If you really want to use this then you have to specify stylesheet like this
<link href="/assets/application.css" rel="stylesheet" />

IIS CustErr CSS Question

I'm trying to style the custom error pages in IIS7 with a linked CSS style sheet.
This works.
<html><head><title>404 - File or directory not found.</title>
<LINK href="http://stage.mysite.com/custErr/css/style.css" rel="stylesheet" type="text/css">
</head><body>Page Not Found</body></html>
I've created a virtual directory in mysite called custErr that contains the css and images needed.
But to make it easier to deploy I'd like to have it relative like this...
<html><head><title>404 - File or directory not found.</title>
<LINK href="../css/style.css" rel="stylesheet" type="text/css">
</head><body>Page Not Found</body></html>
After trying this I find that relative paths don't seem to work. In fact a style sheet in the c:\inetpub\custerr\en-US folder doesn't work either.
Where are these pages being served from?
Is there an easier way of doing this?
So I don't have to modify each and every absolute path for each environment?
I know this is a late reply but the reason why the relative paths don't work (I think) is because if you hosted a site such as www.myfavouritephotos.com and on visiting a directory on that site such as www.myfavouritephotos.com/images/ which is a directory in your website that doesn't have a default document like Default.aspx or whatever your site is set up as serving as a default page, IIS would return a HTTP Response of 404 for not finding a page to serve up or a 403 response because the user may not have the necessary rights to view the content of the directory under that url.
IIS by default would serve either the 404.htm or 403.htm file from within the c:\inetpub\custerr\en-US directory by default but when you replaced it with a custom htm file that replaces 404.htm, the relative path to the stylesheet you reference from that htm file would make a request at what the original url made to the server was so www.myfavouritephotos.com/images/(../css/style.css) which would result in an incorrect relative path so it may be able to be avoided by using a reference to a stylesheet with www.myfavouritephotos.com/css/style.css

Resources