I have a completely static website that'd I've deployed to Google App Engine, but I cannot get it to return my custom 404 page, just the generic one like this.
<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>404 Not Found</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Not Found</h1>
<h2>The requested URL <code>/foo</code> was not found on this server.</h2>
<h2></h2>
</body></html>
I've tried all the solutions I can find but still cannot get it to work. I tried adding require_matching_file: true as recommended in this answer but to no avail. I've also tried to "Edit website configuration" under the bucket storage options.
This is my app.yaml file.
runtime: php55
api_version: 1
threadsafe: true
# Handle the main page by serving the index page.
handlers:
- url: /$
static_files: build/index.html
upload: build/index.html
# Handle folder urls by serving the index.html page inside.
- url: /(.*)/$
static_files: build/\1/index.html
upload: build/.*/index.html
# Handle nearly every other file by just serving it.
- url: /(.+)
static_files: build/\1
upload: build/(.*)
# all other pages are a 404
- url: /.*
static_files: build/404.html
upload: build/404.html
# This doesn't work either
error_handlers:
- file: build/404.html
This is my website's directory structure.
build
│
│ index.html
│ 404.html
│
└───blog
│ │ index.html
│ │
│ └───post-1
│ │ index.html
│ post-2
│ │ index.html
│ | ...
│
└───data
│ │ blog-posts.json
│ │ projects.json
│
└───img
│ │ image-1.jpg
│ │ image-2.jpg
│ | ...
│
└───projects
│ │ index.html
│ │
│ └───project-1
│ │ index.html
│ project-2
│ │ index.html
│ | ...
│
└───static
│ │
│ └───css
│ │ styles.css
│ js
│ │ scripts.js
│
Ultimately I'd like to use a PHP 404 page to send the proper 404 header, but right now I'd settle for a plain HTML page.
This the app.yaml file that worked for me.
runtime: php55
api_version: 1
threadsafe: true
# Handle the main page by serving the index page.
handlers:
- url: /
static_files: build/index.html
upload: build/index.html
# Handle folder urls by serving the index.html page inside
- url: /(.*)/$
static_files: build/\1/index.html
upload: build/.*/index.html
# Handle other file types by just serving them
- url: /(.*\.(css|js|json|gif|eot|png|jpg|jpeg|ico|svg|xml|woff|woff2))$
static_files: build/\1
upload: build/.*\.(css|js|json|gif|eot|png|jpg|jpeg|ico|svg|xml|woff|woff2)$
# all other pages are a 404
- url: /.*
script: build/404.php
The structure is the same as posted in the question, I just changed 404.html to 404.php.
I am following one tutorial for signup and sign in using email verification.
It works fine and it sends a confirmation link on provided email id.
It shows:
I have tried adding alies as well but didn't work
I don't know how do i solve it. Please guide me.
File Structure:
C:.
│
│
│
└───signup-email-verification
│ class.user.php
│ dbconfig.php
│ fpass.php
│ home.php
│ index.php
│ logout.php
│ resetpass.php
│ signup.php
│ store-signup.php
│ tbl_users.sql
│ verify.php
│
├───bootstrap
│ ├───css
│ │ bootstrap-responsive.css
│ │ bootstrap-responsive.min.css
│ │ bootstrap.css
│ │ bootstrap.min.css
│ │
│ ├───img
│ │ glyphicons-halflings-white.png
│ │ glyphicons-halflings.png
│ │
│ └───js
│ bootstrap.js
│ bootstrap.min.js
│ jquery-1.9.1.min.js
│
└───mailer
class.phpmailer.php
class.pop3.php
class.smtp.php
I was trying to access below link
localhost/drop2/signup-email-verification/store-signup.php
As you mentioned in your comment, you are trying to access store-signup.php using below URL.
localhost/drop2/signup-email-verification/store-signup.php
Now, as per above URL, your application should be drop2 and store-signup.php resides under signup-email-verification folder. That means, you folder structure should be
drop2
|
|--- signup-email-verification
|
|---store-signup.php
As per your posted folder structure, you don't have drop2 folder itself.
Also, you are suppose to place your project folder under your server root folder not in C: drive.
I compiled my styles and scripts using webpack, but I noticed that the libs.css and libs.js files are empty rather I have entries in the app.cs and app.js files. Here are my npm settings:
:- webpack.mix.js:
const { mix } = require('laravel-mix');
mix.js('resources/assets/js/app.js', 'public/js/')
.sass('resources/assets/sass/app.scss', 'public/css/');
mix.styles([
'libs/animate.css',
'libs/animations.css',
'libs/app.css',
'libs/bootstrap-theme.css',
'libs/bootstrap.css',
'libs/custom.css',
'libs/font-awesome.min.css',
'libs/head-custom.css',
'libs/sb-admin-2.css',
'libs/sticky.css',
'libs/style.css',
], './public/css/libs.css');
mix.scripts([
'libs/app.js',
'libs/bootstrap.js',
'libs/custom.js',
'libs/gmap.js',
'libs/ipad.js',
'libs/jquery.form.min.js',
'libs/jquery.min.js',
'libs/jquery.pjax.js',
'libs/jquery.slim.min.js',
'libs/myform.js',
'libs/sb-admin-2.js',
'libs/sb-admin-2.min.js',
'libs/sticky.js',
'libs/template.js',
], './public/js/libs.js');
mix.scripts([
'/plugins/jquery.appear.js',
'/plugins/jquery.backstretch.min.js',
'/plugins/modernizr.js',
'/plugins/libs3/jquery.js',
], './public/js/plugins/plugins.js');
mix.scripts([
'/libs/isotope.pkgd.js',
], './public/js/plugins/isotope/isotope.js');
:- mix-manifest.json:
{
"/js/app.js": "/js/app.js",
"/css/app.css": "/css/app.css",
"./public/css/libs.css": "./public/css/libs.css",
"./public/js/libs.js": "./public/js/libs.js",
"./public/js/plugins/plugins.js": "./public/js/plugins/plugins.js",
"./public/js/plugins/isotope/isotope.js": "./public/js/plugins/isotope/isotope.js"
}
:- Directory structure of resource folder:
resources/
├── assets
│ ├── css
│ │ └── libs
│ │ ├── animate.css
│ │ ├── animations.css
│ │ ├── app.css
│ │ ├── bootstrap.css
│ │ ├── bootstrap.min.css
│ │ ├── bootstrap-theme.css
│ │ ├── bootstrap-theme.min.css
│ │ ├── custom.css
│ │ ├── font-awesome.min.css
│ │ ├── head-custom.css
│ │ ├── sb-admin-2.css
│ │ ├── sb-admin-2.min.css
│ │ ├── sticky.css
│ │ └── style.css
│ ├── js
│ │ ├── app.js
│ │ ├── bootstrap.js
│ │ ├── components
│ │ │ └── Example.vue
│ │ ├── libs
│ │ │ ├── app.js
│ │ │ ├── bootstrap.js
│ │ │ ├── custom.js
│ │ │ ├── gmap.js
│ │ │ ├── ipad.js
│ │ │ ├── isotope.pkgd.js
│ │ │ ├── jquery.form.min.js
│ │ │ ├── jquery.min.js
│ │ │ ├── jquery.pjax.js
│ │ │ ├── jquery.slim.min.js
│ │ │ ├── myform.js
│ │ │ ├── sb-admin-2.js
│ │ │ ├── sb-admin-2.min.js
│ │ │ ├── sticky.js
│ │ │ └── template.js
│ │ └── plugins
│ │ ├── jquery.appear.js
│ │ ├── jquery.backstretch.min.js
│ │ ├── libs3
│ │ │ └── jquery.js
│ │ └── modernizr.js
│ └── sass
│ ├── app.scss
│ └── _variables.scss
Try this code below...
mix.styles(['resources/assets/css/libs/animate.css', 'resources/assets/css/libs/animations.css', 'resources/assets/css/libs/app.css', 'resources/assets/css/libs/bootstrap-theme.css', 'resources/assets/css/libs/bootstrap.css', 'resources/assets/css/libs/custom.css', 'resources/assets/css/libs/font-awesome.min.css', 'resources/assets/css/libs/head-custom.css', 'resources/assets/css/libs/sb-admin-2.css', 'resources/assets/css/libs/sticky.css', 'resources/assets/css/libs/style.css' ], 'public/css/libs.css', './');
mix.scripts(['resources/assets/js/libs/app.js', 'resources/assets/js/libs/bootstrap.js', 'resources/assets/js/libs/custom.js', 'resources/assets/js/libs/gmap.js', 'resources/assets/js/libs/ipad.js', 'resources/assets/js/libs/jquery.form.min.js', 'resources/assets/js/libs/jquery.min.js', 'resources/assets/js/libs/jquery.pjax.js', 'resources/assets/js/libs/jquery.slim.min.js', 'resources/assets/js/libs/myform.js', 'resources/assets/js/libs/sb-admin-2.js', 'resources/assets/js/libs/sb-admin-2.min.js', 'resources/assets/js/libs/sticky.js', 'resources/assets/js/libs/template.js' ], 'public/js/libs.js', './');
I think all paths should be relative to the root of the project (where webpack.mix.js is). Try
mix.styles([
'resources/assets/css/libs/animate.css',
//...
], 'public/css/libs.css')
mix.scripts([
'resources/assets/js/libs/app.js',
//...
], 'public/js/libs.js')
After much research I was able to use a laravel project to determine the reason for the empty files. The right syntax should have bee some like this:
mix.js('resources/assets/js/app.js', 'public/js/libs.js')
.sass('resources/assets/sass/app.scss', 'public/css/libs.css');
I should have specified destination file, so the right syntax would be some thing similar to:
```
const { mix } = require('laravel-mix');
mix
.js('resources/assets/js/app.js', 'public/js/app.js')
.js('resources/assets/js/bootstrap.js', 'public/js/app.js')
.js('resources/assets/js/plugins/jquery.appear.js', 'public/js/plugins/jquery.appear.js')
.js('resources/assets/js/plugins/jquery.backstretch.min.js', 'public/js/plugins/jquery.backstretch.min.js')
.js('resources/assets/js/plugins/modernizr.js', 'public/js/plugins/modernizr.js')
.combine([
'resources/assets/js/libs/app.js',
'resources/assets/js/libs/bootstrap.js',
'resources/assets/js/libs/custom.js',
'resources/assets/js/libs/gmap.js',
'resources/assets/js/libs/ipad.js',
'resources/assets/js/libs/jquery.form.min.js',
'resources/assets/js/libs/jquery.min.js',
'resources/assets/js/libs/jquery.pjax.js',
'resources/assets/js/libs/jquery.slim.min.js',
'resources/assets/js/libs/myform.js',
'resources/assets/js/libs/sb-admin-2.js',
'resources/assets/js/libs/sb-admin-2.min.js',
'resources/assets/js/libs/sticky.js',
'resources/assets/js/libs/template.js',], 'public/js/libs/libs.js')
.js('resources/assets/js/isotope/isotope.pkgd.min.js', 'public/js/plugins/isotope/isotope.pkgd.min.js')
.sass('resources/assets/sass/app.scss', 'public/css/lib.css')
.version();
```
The combine syntax should have been used to combine my javascript files.
Help source:
https://github.com/udoyen/blender
I've made a PHP application with Silex. I'm using a WAMP solution on my laptop to develop, in combination with Composer.
Now, when I upload the application (maps 'app', 'src' and 'web') and upload the database, change the config.php to the correct database credentials I issue the composer command (composer.phar -o install) to install the vendor dependencies.
Until this point everything works, Composer makes the 'vendor' map and installs the dependencies without errors. But when I visit the website it shows me the error:
Fatal error: Class 'WanaKo\Provider\Controller\HomeController' not found in /home/wanako/domains/wanako.net/app/app.php on line 37
What can I do to fix that error? I must add that the server is running DirectAdmin with PHP 5.5.16 and that I've made a symlink from 'public_html/' to 'web/'
The directory structure is:
/home/wanako/domains/wanako.net/
├── app
├── logs
├── public_ftp
│ └── incoming
├── public_html -> web/
├── src
│ ├── wanako
│ │ ├── provider
│ │ │ └── controller
│ │ └── repository
│ └── views
│ ├── errors
│ └── home
├── vendor
│ ├── composer
│ ├── doctrine
│ │ ├── common
│ │ └── dbal
│ ├── igorw
│ │ └── config-service-provider
│ ├── imagine
│ │ └── imagine
│ ├── ircmaxell
│ │ └── password-compat
│ ├── knplabs
│ │ └── repository-service-provider
│ ├── monolog
│ │ └── monolog
│ ├── neutron
│ │ └── silex-imagine-provider
│ ├── pimple
│ │ └── pimple
│ ├── psr
│ │ └── log
│ ├── silex
│ │ └── silex
│ ├── swiftmailer
│ │ └── swiftmailer
│ ├── symfony
│ │ ├── config
│ │ ├── debug
│ │ ├── event-dispatcher
│ │ ├── filesystem
│ │ ├── form
│ │ ├── http-foundation
│ │ ├── http-kernel
│ │ ├── icu
│ │ ├── intl
│ │ ├── locale
│ │ ├── options-resolver
│ │ ├── property-access
│ │ ├── routing
│ │ ├── security-core
│ │ ├── security-csrf
│ │ ├── translation
│ │ ├── twig-bridge
│ │ └── validator
│ └── twig
│ └── twig
└── web
├── css
├── font
├── images
└── js
composer.json
{
"name": "Wanako/Wakano.net",
"require": {
"silex/silex": "1.0.*#dev",
"twig/twig": ">=1.8,<2.0-dev",
"doctrine/dbal": "2.*",
"knplabs/repository-service-provider": "dev-master",
"symfony/twig-bridge": "~2.1",
"symfony/form": "~2.1",
"symfony/validator": "~2.1",
"symfony/config": "~2.1",
"symfony/translation": "~2.1",
"symfony/locale": "~2.1",
"monolog/monolog": ">=1.0.0",
"igorw/config-service-provider": "~1.1",
"swiftmailer/swiftmailer": ">=4.1.2,<4.2-dev",
"ircmaxell/password-compat": "dev-master",
"neutron/silex-imagine-provider": "~0.1"
},
"autoload": {
"psr-0": {
"WanaKo": "./src/"
}
}
}
At line 37 of app/app.php I've got:
$app->mount('/', new WanaKo\Provider\Controller\HomeController());
homecontroller.php (in the folder src/wanako/provider/controller/)
<?php
namespace WanaKo\Provider\Controller;
use Silex\Application;
use Silex\ControllerProviderInterface;
use Silex\ControllerCollection;
use Symfony\Component\Validator\Constraints as Assert;
class HomeController implements ControllerProviderInterface {
$controllers = $app['controllers_factory'];
// Bind sub-routes
$controllers->get('/', array($this, 'home'))->method('GET')->bind('home.news');
return $controllers;
}
public function home(Application $app) {
// STUFF
}
I've got no clue on this one. Is there something I did wrong? Wrong folder structure? Something I forgot? If anyone needs more info, just ask. Thanks for helping out!
I believe you have to name your folder structure and files in the correct case for psr0 to work correctly, like this:
src/WanaKo/Provider/Controller/HomeController.php
I have already installed cakephp verion 1.3 on root of domain for Application1.
Now i want to develop another music application, that i want to store in a sub-directory. Now i want to use latest cakephp version for this application.
I am new to cakephp, and donot want to use same cakephp core for both application. First root application was not developed by me.
Directory structure is a s follow.
ROOT
├── .htaccess
├── cake
│ ├── config
│ ├── console
│ ├── libs
│ ├── tests
├── app
│ │ ├── .htaccess
│ │ ├── libs
│ │ ├── vendors
│ │ ├── config
│ │ ├── plugins
│ │ ├── views
│ │ ├── models
│ │ ├── controllers
│ │ ├── temp
│ │ ├── WEBROOT
│ │ │ ├── .htaccess
├──music (this one i want to use for latest version cakephp installation).
I installed cakephp 2.5.2 in music directory, but unable to access this by www.example.com/music/
It redirect to first root application i.e. example.com/member/index.
In
├── app
│ │ ├── config
│ │ ├ ├──routes.php
I have this:
Router::connect('/', array('controller' => 'members', 'action' => 'index'));
If unable to understand what i want:
My Question:
How can i run two different cakephp version, one on root of the domain
and second in subdirectory (music).
If not possible i will use same version, but one application will be in music sub directory.
Both the versions should work fine, just make sure you have not written a htaaccess rule to redirect all incoming request to the first cakephp folder.