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.
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.
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#rewritebase It will point any costumerN/laravel to http://example.com.
You may have to play with starting or ending slashes.
did it work? or did you use a different solution?
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).
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,
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>
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 )
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community