mercredi 3 juillet 2019

LARAVEL 5 on subdomain have routing issues

How I can get work Laravel 5 in subdomain.

I have I created to root path "api" folder for laravel core files and dragged "/public" path files to subdomain folder "App".

subdomain app.website.com domain website.com

domain website files are in htdocs. So laravel files are same level as root folders.

Screenshot:

ROOT PATH IMAGE

Do I have to change something in routing files?

api/routing:

Route::get('/', function(){
    // TODO here for your custom routes;
    return redirect(env('APP_REDIRECT')); //dashboard
});
include('pages.php');
Route::get('setup/{config}', 'Core\SettingsController@setup');
Route::get('login', 'Core\AuthController@login');
Route::get('img/{path}', 'Core\ImageController@show')->where('path', '.*');
Route::post('error', function(Request $request) {
    \Mail::to(env('APP_EMAIL','workemail@gmail.com'))->send(new App\Mail\ErrorReport($request->all()));
    return redirect('/')->with(['message'=>'Error report has been submited.','status'=>'success']);

});
Route::group(['middleware' => ['web','auth'], 'prefix'=>'admin'], function () {
    Route::get('/', function(){
        return redirect(env('APP_REDIRECT'));
    });
    include('routes.php');
});
Route::group(['middleware'=>['web']],function() {

    Route::post('login', 'Core\AuthController@signin');
    Route::get('register', 'Core\AuthController@create');
    Route::post('register', 'Core\AuthController@register');
    Route::get('activation', 'Core\AuthController@activate');
    Route::get('remember', 'Core\AuthController@getRemember');
    Route::post('remember', 'Core\AuthController@postRemember');
    Route::get('reset/{token}', 'Core\AuthController@getReset');
    Route::post('reset/{token}', 'Core\AuthController@postReset');

    Route::group(['middleware'=>['auth']], function() {
        // Dashboard
        Route::get('dashboard','Core\DashboardController@index');
        // User
        Route::group(['prefix'=>'user'], function() {
            Route::get('/', 'Core\UserController@getIndex');
                Route::get('update', 'Core\UserController@getUpdate');
.......

I know change index file line 22 and 36... seems routing issue..

if reloading page it changes link fast "/dashboard" to "/login" and then to deafault "/"

App/.htaccess:

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

    RewriteEngine On

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

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

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
<IfModule headers_module>
    Header set Access-Control-Allow-Methods "GET,POST,PUT,DELETE,OPTIONS"
    Header set Access-Control-Allow-Origin "*"
    Header set Access-Control-Allow-Headers "Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,Keep-Alive,X-Requested-With,If-Modified-Since"
</IfModule>


# compress text, html, javascript, css, xml:
#AddOutputFilterByType DEFLATE image/jpg
#AddOutputFilterByType DEFLATE image/jpeg
#AddOutputFilterByType DEFLATE image/gif
#AddOutputFilterByType DEFLATE image/png
#AddOutputFilterByType DEFLATE text/plain
#AddOutputFilterByType DEFLATE text/html
#AddOutputFilterByType DEFLATE text/xml
#AddOutputFilterByType DEFLATE text/css
#AddOutputFilterByType DEFLATE application/json
#AddOutputFilterByType DEFLATE application/xml
#AddOutputFilterByType DEFLATE application/xhtml+xml
#AddOutputFilterByType DEFLATE application/rss+xml
#AddOutputFilterByType DEFLATE application/javascript
#AddOutputFilterByType DEFLATE application/x-javascript

# Or, compress certain file types by extension:
<files *.html>
SetOutputFilter DEFLATE
</files>



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2NwNvOB
via IFTTT

Aucun commentaire:

Enregistrer un commentaire