php - access a folder in 'public' directory of laravel
How can I access a folder placed in thepublic
directory of my default laravel installation. This question is for both -testing
as well aslive
purpose.
While Testing-
I am testing on windows using XAMPP's apache http server. I have placed my app's root folder in thehtdocs
folder of XAMPP. Thus, when I try to access a folder in public directory,'localhost/myappname/public/blog'
it redirects me to'localhost/blog'
.
I don't want this behavior. I want it to pick up the'index.php'
file present at'localhost/myappname/public/blog/'
location. But it doesn't do so.
While Live-
I have my site live on ubuntu with apache http server. When I try to access'mysitename.com/blog'
in the firefox, it gives me this error -
Firefox has detected that the server is redirecting the request for this
address in a way that will never complete.
I have no hint about what's wrong. I have tried spending two days working with laravel's default.htaccess
file(inpublic
folder) and apachehttpd.conf
but still not able to resolve it. Have searched a lot over stackoverflow and google but still no clue about where I am wrong. Please guide me.
Added:
The content of.htaccess
file is -
<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]
Answer
Solution:
You just need to comment this line in your
.htaccess
file.Comment it or strip out from the file. This will solve both your directory
/blog
issue as well as redirect loop issue.Answer
Solution:
I used the
Alias
feature of apache to overcome this problem. I added an alias for'/blog'
in my virtual host configuration.