Consider this is my domain www.example.com
I am using laravel in my website
This is the laravel structure
app/
bootstrap/
public/
vendor/
server.php
To remove the index.php and public from the url i followed this answer
i.e.,
had the .htaccess in the root path
and renamed the server.php file as index.php
Here is my .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]
It works good, but the problem is i am having subdomain as
projects.example.com
While i create a sub directory here i.e.,
projects.example.com/firstproject
It always shows the internal server error
How can i fix this like, having exception to that directory or something like that ?
The htaccess file affects the directory the file is in and all subdirectories. If you have subdirectories that you don't want mod_rewrite rules to affect, then you need to add an htaccess file with in the subdirectory with the rewrite engine turned on (so that none of the parent rules have precedence).
Just add this to an htaccess file in your subdirectory without any actual rules:
RewriteEngine On
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With