Here is my directory structure
localhost or livehost
-app
-bootstrap
-public
-vendor
-code
-demo
Here is my .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
RewriteRule ^(.*)$ public/blog/$1 [L]
</IfModule>
Here is my route
Route::get('/', 'Sys@Home');
Route::get('blog', 'Sys@Blog');
Route::get('contact', 'Sys@Contact');
To access this data, I do not want to enter my url as
localhost/public/
localhost/public/blog
localhost/public/contact
Instead, just enter
localhost
localhost/blog
localhost/contact
At the same time, it should not be applied to them in folders /codeand /demofor access to the directory.
So I had to write an exception from these directories from this question .htaccess exception for certain folders
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule %{THE_REQUEST} /code
RewriteRule %{THE_REQUEST} /temp
RewriteRule ^ - [L]
RewriteRule ^(.*)$ public/$1 [L]
RewriteRule ^(.*)$ public/blog/$1 [L]
</IfModule>
After applying this, I can access the folder localhost/codeand
localhost/demo
But I can not access the folder, for example
localhost
localhost/blog
localhost/contact
How can I make this possible?
source
share