htaccess for domain and subdomain with laravel

后端 未结 2 428
逝去的感伤
逝去的感伤 2021-01-23 19:48

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

O         


        
2条回答
  •  北恋
    北恋 (楼主)
    2021-01-23 20:21

    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?

提交回复
热议问题