My route not working on subdomain:
Route::domain('sub.example.com')->middleware(['auth'])->group(function () {
Route::get('/',function(){
return 'Hi!';
});
});
I'm using a shared linux cloud host.
When I visit sub.example.com it runs host default index.php in subdamin's folder!
Related
I want to open my subdomain admin.example.com and get directly to the admin login page, without the index.html page that comes before and tells me the page is in production environment, to improve usability to the customer and avoid something stupid like admin.example.com/admin.
Maybe I could do it with middlewares, but I'm clueless.
I'm using heroku.
Thank you
This is currently not supported.
Currently we don't support serving the admin from the root, added as a feature request
See https://github.com/strapi/strapi/issues/9302
Workaround
You can redirect / to /admin with a custom middleware.
Create the middleware
You may need to create the directory (mkdir -p middlewares/redirect/).
// middlewares/redirect/index.js
module.exports = () => {
return {
initialize() {
strapi.router.get('/', (ctx) => {
ctx.redirect(strapi.config.get('server.admin.url', '/admin'))
})
},
};
};
Enable it
// config/middleware.js
module.exports = {
settings: {
redirect: {
enabled: true
}
}
}
i have server from Digital Ocean. I use Serverpilot. How do i domain routing using by laravel 5.3 ?
Rweb example :
Route::group(['domain' => 'admin.developer.app'], function () {
Route::get('/', function () { return view('dash') });
});
Route::group(['domain' => 'department.developer.app'], function () {
Route::get('/', function () { return view('dash') });
});
You need access to DNS zonefile settings at your DNS provider.
Set up a catchall DNS entry (an A record for * pointing to your server address)
Your .htaccess file must be set up correctly that it catches all subdomains and renders developer.app for your routing to work correctly. (I think the default laravel .htaccess is fine)
Add ServerAlias *.developer.app to your VirtualHost config and restart the webserver
I have the following in /var/www/html/blog/routes/web.php
Route::get('/', function () {
return view('welcome');
});
Route::get('test', function () {
return view('test', ['name' => 'Chris']);
});
If I go to http://52.214.14.137 then I see /var/www/html/blog/resources/views/welcome.blade.php.
If I go to If I go to http://52.214.14.137/test then I would expect to see /var/www/html/blog/resources/views/test.blade.php but instead I am seeing a 404.
What am I missing?
I was using Amazon EC2 and the .htaccess file was being ignored by default.
I had to change /etc/httpd/conf/httpd.conf so
AllowOverride None
Become
AllowOverride All
I then restarted Apache with the command below and then Laravel worked perfectly.
sudo service httpd restart
Default route is running
for example:
Route::get('/', function () {
return view('welcome');
});
When i run this http://localhost/laracast/public
Shows outputs as LARAVEL 5
But when I add new route to
Route::get('/hello', function() {
return 'Welcome to Laracast';
});
It shows output as => url not found
I am using
1.Windows7
2.Wamp Server
3.Composer and
4.GIT BASH
what the mistake i done it
If you are changing the default route to /hello, you need to make sure you visit http://localhost/laracast/public/hello in the browser.
If you are just trying to display your own message, change the default route to:
Route::get('/', function() {
return 'Welcome to Laracast';
});
i.e. remove hello from the route and it will correctly display your welcome message when visiting http://localhost/laracast/public
I have an index.html file in the parent dir and with http://localhost:3000/#/ that's what's being loaded instead of the sidebar.html file. If I try http://localhost:300/#/home it redirects to todo
No errors being thrown.
app.js
'use strict';
angular
.module('App', [
'ui.router'
//'lbServices'
])
.run([ '$rootScope', '$state', '$stateParams',
function ($rootScope, $state, $stateParams) {
$rootScope.$state = $state;
$rootScope.$stateParams = $stateParams;
}])
.config(['$stateProvider','$urlRouterProvider', function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('home', {
title: 'Dashboard',
url: '/',
templateUrl: '../shared/sidebar/sidebar.html',
controller: 'sidebarCtrl'
});
$urlRouterProvider.otherwise('todo');
}]);
server.js
var loopback = require('loopback');
var boot = require('loopback-boot');
var app = module.exports = loopback();
// Set up the /favicon.ico
app.use(loopback.favicon());
// request pre-processing middleware
app.use(loopback.compress());
// -- Add your pre-processing middleware here --
// boot scripts mount components like REST API
boot(app, __dirname);
// -- Mount static files here--
// All static middleware should be registered at the end, as all requests
// passing the static middleware are hitting the file system
// Example:
var path = require('path');
app.use(loopback.static(path.resolve(__dirname, '../client')));
app.use(loopback.static(path.resolve(__dirname, '../node_modules')));
// Requests that get this far won't be handled
// by any middleware. Convert them into a 404 error
// that will be handled later down the chain.
app.use(loopback.urlNotFound());
// The ultimate error handler.
app.use(loopback.errorHandler());
app.start = function() {
// start the web server
return app.listen(function() {
app.emit('started');
console.log('Web server listening at: %s', app.get('url'));
});
};
// start the server if `$ node server.js`
if (require.main === module) {
app.start();
}
Not sure if this is related, but initially my server was set to listen on 0.0.0.0:3000 but if I typed that into the URL bar it went to Google search. Although if I type localhost:3000 it seemed to work. I have since changed the listening port to localhost:3000.
In case, that this url http://localhost:3000/#/, which should trigger state home - is loading index.html - should mean, that the path
templateUrl: '../shared/sidebar/sidebar.html',
is not set properly. Use the (e.g. chrome) developer tools and check if the sidebar.html is being loaded.
The fact that this url http://localhost:300/#/home is navigating to TODO state is also correct, becuase '/home' is not mapped to home state
.state('home', {
...
url: '/',
});
so the default is triggered
$urlRouterProvider.otherwise('todo');
NOTE: From the question, and described issue I expect that the index.html is set properly. It contains <div ui-view=""></div>, which will be filled with sidebar.html. That's why I would suspect the wrong path to that partial view template...