Wednesday, March 29, 2017

I copied my laravel folder to a subdomain directory, and now routes aren't working

Okay I am developing an app with laravel 5.4.

I copied all the files from the laravel installation to a new sub domain, including all the . files that don't copy with a standard copy command.

It easily loads the page without hassle. However the moment any routes are involved it doesnt work, meaning when i click on login, it just says doesnt exist.

I have cleared the cache, in hope that would fix it, however it hasnt.

Please advise of what could be the issue.

Thanks all of you.

//Edit

The subdomain is created on a new virtual host.

File Structure

//Edit

Okay I dont think the error is with laravel at all, i think it is with the virtual hosts file in apache.

The reason for me thinking this is when i change the document root to a working version of laravel it doesnt work either. However the working version of laravel when i use the direct ip address for it then it works.

//Edit

The .htaccess contains

<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>

//Edit

The Virtual host file is as follows

<VirtualHost *:80>

    ServerAdmin info@1bg.co.za

    ServerName thirddoor.livingphate.com

    ServerAlias thirddoor.livingphate.com

    DocumentRoot /var/www/thirddoor.livingphate.com/public

    ErrorLog ${APACHE_LOG_DIR}/error.log

    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

//Edit

Okay, thanks to Digital Ocean, they have helped me and given me more information. The Issue is laravel and the way that laravel works with sub domains.

They have sent me the following links however i have not

http://jpcamara.com/clean-subdomains-in-laravel/



via LivingPhate

Advertisement