1

I'm trying to figure out how to set up a domain and subdomain to work on a shared hosting account. It is a Laravel 5.1 application.

My access file is

Options +SymLinksIfOwnerMatch

RewriteEngine On

RewriteRule ^ index.php [L]

I just purchased another domain and added it on, but I get a 500 error. I renamed the access file and then it worked. So it has something to do with the access file. Essentially I want two separate domains with and I'm wanting two separate laravel applications, one for each.

I'm not familiar with atacceess.

Dlaugh14
  • 313
  • 1
  • 5
  • 16
  • When you get a 500 error, look into Apache's error log file. Without a hint, nobody can help you. – Olaf Dietsche Jun 27 '16 at 06:22
  • There are no errors from the error log that I am seeing. The last error in the error_log file is from june 16th. – Dlaugh14 Jun 28 '16 at 03:50
  • Essentially I have one main laravel website and it uses the laravel framework with the above code in the htaccess, but I also want to host another laravel web app on my subdomain. When I rename this file then the subdomain works, but if i keep it as is then it causes that error and doesn't allow access to my subdomain – Dlaugh14 Jun 28 '16 at 03:52

2 Answers2

1

Maybe, you get a redirect loop, because the rule isn't protected by a condition. Although the default htaccess of Laravel should already contain them.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]
Olaf Dietsche
  • 72,253
  • 8
  • 102
  • 198
0

Olaf Dietsche's answer does work for me.

Here is another thing I came upon a website that also worked just before I saw his post. I guess I was reading that this would send a 404 to that directory.

Options +SymLinksIfOwnerMatch

RewriteEngine On

RewriteRule ^ index.php [L]

            RewriteCond %{HTTP_HOST} ^(www.)?main-topdomain.com$ [NC]
            RewriteCond %{REQUEST_URI} ^/subdomain-folder/(.*)$
            RewriteRule ^(.*)$ - [L,R=404]

So along with this comes another question if anyone is in my boat. I have my subdirectory inside of my root directory.***

dlaugh.com/public_html

laravel folders and access** inluding

app
bootstrap
config
database
etc...

but also I have my sub folder

    app
    bootstrap
    config
    database
    etc...
    **mysubdomain in that folder**

Is it better practice to put

-main_domain_folder and
-subdomain_folder
in public_html
and then the
/app
/config
/database

would be in the main_domain_folder rather than passing the subdomain through the main domain?

Dlaugh14
  • 313
  • 1
  • 5
  • 16