Support the ongoing development of Laravel.io →
Configuration
Last updated 1 year ago.
0

Do you have a folder stucture for costumer1, costumer2, costumer3 ...?

You can use laravel's router to handle this with a filter/group combination. But this depends on where costumer1 comes from.

Last updated 1 year ago.
0

I don't have a folder structure for the customers. These names are aliases, defined in apaches httpd.conf, pointing to the document root (/var/www). Laravel is in a subfolder (/var/www/laravel).

Alias /customer1 "/var/www"
Alias /customer2 "/var/www"
Alias /customer3 "/var/www"

So http://example.com/customerN/laravel/public does work but only if I hardcode the RewriteBase to customerN.

Last updated 1 year ago.
0
laravel/public/.htaccess:
<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On
    RewriteBase /

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(costumer[0-9]+)/laravel/$   public/$1 [L]
</IfModule>

No expert on .htaccess but i've used this kind off RewritRule's in the past when there where no pretty URL's. according to http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewr... It will point any costumerN/laravel to http://example.com.

You may have to play with starting or ending slashes.

Last updated 1 year ago.
0

did it work? or did you use a different solution?

Last updated 1 year ago.
0

Unfortunately I was unable to make this work. I ended up running Laravel on a subdomain and using other means to get the customer number (sessions).

Last updated 1 year ago.
0

Hello,

I have seen many posts with the same configuration and the same problem. I tried pretty much the same things that you did last few days. Any clues from someone?

I have something like: http://sub.domain.com/websiteX/

http://sub.domain.com/websiteY/

http://sub.domain.com/websiteZ/

I need to have a multisites on the same subdomain in differents subfolders.

Thanks,

Last updated 9 years ago.
0

I went the sub domain route too but it was annoying because I only have one SSL.

I was able to solve it another way by basically copying Laravel's .htaccess rules into my VirtualHost config and adding a RewriteBase. - Adding the RewriteBase to your .htaccess seemed to solve this for a lot of people, but I suspect Apache was disregarding the config for me, not sure why.

Alias "/myAlias" "/var/www/myApp/public"
<Directory "/var/www/myApp/public">
    RewriteEngine On
    RewriteBase "/myAlias/"

    # 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}]
</Directory>
Last updated 7 years ago.
0

I find this, https://laravel.com/docs/5.2/routing#route-group-prefixes

I don't know why subsequent documentation misses the second paragraph about using parameters ( >= 5.3 )

Last updated 6 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

aebersold aebersold Joined 3 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.