Skip to main content

Subdomain displays /public how to remove?

Comments

6 comments

  • 24x7server
    Hi, What is the redirection code you set? Can you share it here with us? Also, can you check if the document root of the subdomain is properly met and that there is no additional redirection codes in any .htaccess file?
    0
  • cPanelLauren
    Hi @Mohit Shrestha As suggested by @24x7server more information on how you're redirecting the domain would be helpful. Also, the domain's documentroot would also be useful in identifying why that's occurring. Thanks!
    0
  • Ahmed2208
    My subdomain directory is like "public_html/test" . I have uploaded my laravel project in test by unziping. I also cut all files from public and pasted here. My .htaccess is something like SetEnv HTTP_MOD_REWRITE On RewriteEngine On RewriteBase /
    Now, my index file is something like this, * * @package Laravel * @author Taylor Otwell */ define('LARAVEL_START', microtime(true)); /* |-------------------------------------------------------------------------- | Register The Auto Loader |-------------------------------------------------------------------------- | | Composer provides a convenient, automatically generated class loader for | our application. We just need to utilize it! We'll simply require it | into the script here so that we don't have to worry about manual | loading any of our classes later on. It feels great to relax. | */ require __DIR__.'/../vendor/autoload.php'; /* |-------------------------------------------------------------------------- | Turn On The Lights |-------------------------------------------------------------------------- | | We need to illuminate PHP development, so let us turn on the lights. | This bootstraps the framework and gets it ready for use, then it | will load up this application so that we can run it and send | the responses back to the browser and delight our users. | */ $app = require_once __DIR__.'/../bootstrap/app.php'; /* |-------------------------------------------------------------------------- | Run The Application |-------------------------------------------------------------------------- | | Once we have the application, we can handle the incoming request | through the kernel, and send the associated response back to | the client's browser allowing them to enjoy the creative | and wonderful application we have prepared for them. | */ $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); $response = $kernel->handle( $request = Illuminate\Http\Request::capture() ); $response->send(); $kernel->terminate($request, $response);
    But, when I click test.xyz.com. URL takes me to test.xyz.com/public/public. Any solution?
    0
  • cPanelLauren
    Is there an .htacces in /home/user/public_html with redirects in place?
    0
  • Ahmed2208
    Brother solved it,
    • renamed server.php to index.php
    • made an .htaccess in the directory with
    Options -MultiViews -Indexes 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_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !^/public/ RewriteRule ^(css|js|images)/(.*)$ public/$1/$2 [L,NC]
    • Then, in the public directory made the directory 2 steps before. something like
    require __DIR__.'/../../test.xyz.com/vendor/autoload.php'; /* |-------------------------------------------------------------------------- | Turn On The Lights |-------------------------------------------------------------------------- | | We need to illuminate PHP development, so let us turn on the lights. | This bootstraps the framework and gets it ready for use, then it | will load up this application so that we can run it and send | the responses back to the browser and delight our users. | */ $app = require_once __DIR__.'/../../test.xyz.com/bootstrap/app.php';
    TADA ! It worked.
    0
  • cPanelLauren
    Glad to see you were able to get the issue resolved. Thanks for updating here.
    0

Please sign in to leave a comment.