InsideDarkWeb.com

my laravel sub-domain urls does not work except homepage

I am new to hosting web apps online. I wanted to host an app in my subdomain eg departmennt1.example.com. I added the subdomain in cPanel. Located its directory in file manager. It happens that the subdmain is also a folder in the root directory. I upload the locally working site in the subdomain folder. After setting up my database on the .env folder. I also ensure that my public folder files were inside the subdomain folder. I ensure that the app and the autoload.php in index.php file in the subdomain folder is pointing correctly to the vendor and boostrap folder.

After that, I tried loading the subdomain address in the browser, but only the index page ie.

Route::get('/', function () {
    return view('welcome');
});

any other URL will return like login will show

Not Found

The requested URL was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

I tried it on another hosting company where the subdomain by default resides in the public_html directory and everything worked out fine.

How can I host at the first hosting company?

Webmasters Asked on November 22, 2021

1 Answers

One Answer

I was able to solve the whole problem by changing my .htaccess file from

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php72” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php72 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

to

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

I dont know what the code above does. I'll love it to get explation for the greater good of all

Answered by Othman on November 22, 2021

Add your own answers!

Related Questions

How do search engines handle ?

3  Asked on October 5, 2020 by tom-marthenal

     

Can you run a fetish forum anonymously?

0  Asked on July 22, 2020 by anony-inflates

       

Ask a Question

Get help from others!

© 2021 InsideDarkWeb.com. All rights reserved.