I deployed a static html, css, JS application to heroku using a dummy php file to trick heroku. I also added a composer.json file to the root directory. I successfully deployed the website but when it's opened all the css and JS properties are lost.
Any ideas?
here is the content of my php file:
<?php
include("index.html");
?>
Using this code will work it out.
Create a file named index.php on Github and paste this code.
<?php header ( 'Location:/index.html '); ?>
*When you want to deploy a static web page to Heroku, it asks you to build it with php. (Although this is just html and css files.)
Related
I have a simple site where users can write messages & it saves them to the server, or they can read any other message people have wrote on the server too. I wrote the server side in PHP and everything works great on my localhost. I only have 2 PHP files and they get called either on a form submit or via an ajax request. I deployed my site to Heroku, but the only thing that works/displays right now is my index.html. Inside index.html I do not even deal with Javascript or the PHP files, it's simply that the CSS isn't showing. I have Procfile and composer.json at the root of the project, and everything else in /website/.
My composer.json is empty(it's just { } )
My Procfile is
web: vendor/bin/heroku-php-apache2 /website
And my index.html head css reference looks like this:
<link rel="stylesheet" type = "text/css" href="/website/style.css">
Any ideas on how to fix this issue? Thank you!
We use CakePHP 2.7.9 and Minify plugin on a CentOS server running Apache 2.2.
https://github.com/maurymmarques/minify-cakephp
The plugin works fine and now we can minify css files like this.
echo $this->Minify->css(array('default', 'global'));
The code above generates URL like this.
http://example.com/min-css?f=default.css,global.css
And now we want to deny access to original files under webroot/css. How can it be done in CakePHP? We want to return 404 or 401 or something like that for direct URL access like this.
http://example.com/css/default.css
And now we want to deny access to original files under webroot/css
Simply don't but non public code and files into the public webroot. It's not recommended in any case. Point your minifier to the files and set its output folder to webroot.
We use task runners and keep the minification code outside of the actual app. This is stuff that doesn't belong into the application itself - IMHO.
We use php Robo and on the JS side Gulp for minification and automatically trigger the tasks on deployment. All our SCSS and JS files are outside of the webroot. We have just a few asset includes in our app code and they almost never change. Robo and Gulp have watchers that rewrite the asset files as we change them on when the app is deployed it automatically generates minified files.
I am uploading a bootstrap template through Heroku. The name of the template is: Brushed. http://www.alessioatzeni.com/blog/brushed-template/
I route to the home page through a php file with the following code:
<?php include_once("home.html"); ?>
Everything works in the emulator on cloud9, however, when I upload it to Heroku only my HTML shows up without any of my CSS. Does anyone have any idea of what I can do?
Here is a link to my site: https://mariatorres.herokuapp.com/
It is not a rails app, just a static bootstrap template.
If you use Chrome's Code Inspector and go to Network, and try to reload your webpage, you will see that the .css files are 404 not found... you can reproduce the same if you load your webpage, open it's source and see (and try to open) the .css links.. you will see that they are not found. To fix this, where you load the .css files try to use the full path of the CSS, or if you rewrite/route your paths, fix the path to the CSS files..
Only by showing us the include statement, is not enough..
I am just trying to host a laravel site to production. There is an error with the routing all my css and javascript files are being treated like a route instead of files and they are not loading
<script src='http://project.com/project/assets/js/jquery-1.9.1.js' type='application/javascript'></script>
I can see that this html is generated but the files are not being loaded When I click on the link I get a NotFoundHttpException
This is wroking fine in my local machine. This error is present only in live server.
Thanks in advance!
The src link to your js file is set using Laravel's HTML::script()? If not change it because this will help so that you can have proper full urls for js and css files. So if you have a js file like public/assets/js/custom.js you should call it like this:
{{ HTML::script('assets/js/customs.js') }}
and you will be fine. Just remember that your starting point for assets is inside public folder. HTML::script() or HTML::style() get you there at once.
It turns out the issue is with nginx configuration. The root folder to the server was set incorrectly. So it was looking for differnt files. Not a code issue just and issue with the server environment
I'm trying to use the uaparser.php library to detect the operating system, but when I use the following it just loads the github page for the library. This is the github page https://github.com/tobie/ua-parser/tree/master/php
<?php
require('uaparser.php');
?>
I've placed the file in my includes folder which resides in the Views directory. Perhaps, that is the source of the problem? Where would be an appropriate place to put this file?
I assume when you downloaded uaparser.php you clicked File->Save Page As... (or something simular). That is why the page loads when you require/include it.
Open up the local file uaparser.php and confirm that it is actually the php code and not the html of the page.
Doing this is fine anywhere you need it.
You can place this anywhere, but for codeigniter it should be in the 3rd party folder, but it doesn't matter.