Laravel - Dynamic Wildcard Subdomain Creation on GoDaddy Server - laravel

I want to create wildcard dynamic subdomain on GoDaddy server with Laravel framework.
For this.
I have added A record in my DNS zone in domain setting like this...
Then in Laravel routes file I have added like this....
But then also it is not working proper as I wanted.
So anybody can please check and help me to solve this problem.
Thanks in advance.

Related

How to overwrite route() functionality in Laravel 9.x

I made webpage with Laravel which next I put on private server. After doing that I found out that my links to named routes aren't working.
After online research and talking with server administrator I learned that route() helper in Laravel is using request domain to build links, and that this server will always give me IP address instead of domain and that it is impossible on this server to access anything via IP address, it needs to be via domain.
Because of need to quick dealing with the problem I temporary made custom helper that using route() inside of it and changing IP address in result to app domain (taken from config). It works fine but I can't use third party libraries thanks to that. And I don't like it.
I tought about using middleware on whole app to change that IP address in request on domain but I have no idea (And I couldnt find it in Google) how to do that so route() helper would read it properly. Can you give me any ideas about that?
Thanks in advance.
You can do this little hack if your APP_URL env variable is not working for whatever reason. In your AppServiceProvider boot function add the following:
$this->app->resolving(UrlGenerator::class, function (UrlGenerator $generator) {
$generator->forceRootUrl(env('APP_URL'));
});
This should force a new root url when resolving the url generator.

How to point subdomain to specific Laravel view? [Laravel]

I've a primary domain.
Just for example let's take my domain as 'mydomain.com'. And a subdomain of 'subdomain.mydomain.com'.
My primary domain points to /public/index.php and the view rendered is
in /resources/views/welcome.blade.php.
There is no problem with my primary domain. It is fine.
Similarly, I want my subdomain to call the view located at
/resources/views/subdomain/index.php.
How can I do so?
I'm using nginx web server, mysql 5.6 and php7.2
Any help would be appreciated.
Thank You.

Change Base URL in Laravel 5.5

I 'm trying to change the base URL http://myscreenclass.com/ to http://myscreenclass.com/home. I changed the .env file and updated the config/app.php file as well. I tried to solve the issue many different ways, but nothing happens.
How can I change the URL?
I am trying to change base URL http://myscreenclass.com/ to http://myscreenclass.com/home
May I suggest reading up on routing with Laravel? You can achieve this by adding this to your web routes file.
Route::redirect('/', '/home');

codeigniter ion-auth2 redirects me to an ip version 6 address

I am quite new with codeigniter and ion-auth2 package for authentications. right now I have my codeigniter and the ion-auth package, both are merged,database has set upped and looks to have no error. I can access my index.php and default page with no error, but when I want to go to my ion-auth route using it's route like this:
localhost:81/code/index.php/auth
after i press enter.it redirects me to a route like this:
[::1]/code/index.php/auth/login
My problem is why I am getting the IPv6 format after accessing the auth controller.
The page looks like:
that's just your localhost ip, when you deploy your project online it will be something like a ipv4 address, don't worry about it. It's okay and will impact no harm to your project :)
You could update your Apache/Nguni settings to respond to this as well but the easiest solution is probably to set your base_url in your codeigniter config file you “local host” or whatever you’re using for the v4.

Can't login to two laravel project in same browser another log out

I am working on the Laravel project 5.3 and the problem I am facing is when I log in to frontend or the admin Panel another session destroy and logouts the application, need some solution. Both are running on different ports like
example.com
example.com:75/public
example.com:81/public
I am extremely sorry for the bad English and thank you in advance.
User session is stored in the browser cookie, and cookie is related to website domain name. So in your case looks like you use one cookie file for two websites (because it use same name). You can configure virtual host to solve this.
I just changed my .env configuration:
CACHE_DRIVER=file
CACHE_PREFIX=*with_different_name*
SESSION_DRIVER=file
SESSION_COOKIE=*with_different_name_session*
change chache_prefix and session_cookie with different name between your project
it worked for me.
You can connect one of them something like project.local and connect the other with localhost:8000
Just search laravel vhost(virtual host). Thats easy. Good Luck.

Resources