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.

3
  • When you get a 500 error, look into Apache's error log file. Without a hint, nobody can help you. Commented Jun 27, 2016 at 6: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. Commented Jun 28, 2016 at 3: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 Commented Jun 28, 2016 at 3:52

2 Answers 2

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]
Sign up to request clarification or add additional context in comments.

Comments

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?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.