1

I am currently editing my .htaccess file to redirect any request to the public folder inside my project but Im just getting this error

404 Object not found

Below is the code in the .htaccess folder

RewriteEngine on

RewriteCond %{REQUEST_URI} !^/public/
RewriteRule (.*) /public/$1

Im not very well acquainted with htaccess code, what is wrong with this?

UPDATE

Below is a summarized file structure in my project, if it helps

-projectfolder
|
|--.htaccess
|
|----includes
|
|----mvc
|
|----cache
|
|----public

Thanks in advance

Stanley Ngumo
  • 4,089
  • 8
  • 44
  • 64

1 Answers1

1

It appears your .htaccess is not directly under DocumentRoot. Try this rule instead:

RewriteEngine on

RewriteRule ^((?!public/).*)$ public/$1 [L,NC]
anubhava
  • 761,203
  • 64
  • 569
  • 643