apache - Clean URL with Laravel on primary domain only -
i'm on shared hosting account (no access more preferable solutions i've got go .htaccess rule.
when implement pretty url remove public folder http 500 error on subdomains.
i'm not versed enough in .htaccess work out rewrite rule(s) necessary. can help? .htaccess looks follows:
addtype application/x-httpd-php55 .php rewriteengine on rewriterule ^(.*)$ public/$1 [l] edit:
what want accomplish:
http://example.com instead of http://example.com/public/
while excluding xsubdomain.example.com
when try going subdomains see 500 error. when check server's master error_log tells me request exceeding limit of 10 internal redirects.
i found have .htaccess file in public_html directory responsible. when temporarily renamed file access both of subdomains.
it appears need set .htaccess rules affect main directory or exclude subdomain
web root .htacess
rewriteengine on # don't if blog subdomain example. rewritecond %{http_host} ^blog\. [nc] rewriterule ^ - [l] rewritecond %{http_host} ^(www\.)?example\.com$ [nc] rewritecond %{the_request} ^[a-z]{3,9}\ /public/([^&\ ]+) rewriterule .* /%1? [r=301,l] rewritecond %{http_host} ^(www.)?example.com$ [nc] rewriterule ^(.*)/?$ public/$1 [l]
/public/ .htaccess
<ifmodule mod_rewrite.c> <ifmodule mod_negotiation.c> options -multiviews </ifmodule> rewriteengine on # redirect trailing slashes... rewriterule ^(.*)/$ /$1 [l,r=301] # handle front controller... rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ index.php [l] </ifmodule> # handle front controller... rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ index.php [l]
just use in .htaccess if want main domain.
addtype application/x-httpd-php55 .php <ifmodule mod_rewrite.c> <ifmodule mod_negotiation.c> options -multiviews </ifmodule> rewriteengine on #don't if blog subdomain example. rewritecond %{http_host} ^blog\. [nc] rewriterule ^ - [l] rewritecond %{http_host} ^(www\.)?example\.com$ [nc] rewritecond %{the_request} ^[a-z]{3,9}\ /public/([^&\ ]+) rewriterule .* /%1? [r=301,l] # redirect trailing slashes... rewriterule ^(.*)/$ /$1 [l,r=301] # handle front controller... rewritecond %{http_host} ^(www\.)?example\.com$ [nc] rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ public/index.php [l] </ifmodule> you can if type in public redirect url without public. let me know if works you.
Comments
Post a Comment