Good day to you all. I'm trying to redirect my index.php from the public folder to the main or root folder.
I've added the .htaccess file with the following code.
RewriteEngine On
RewriteBase /project-Folder/
RewriteCond %{THE_REQUEST} /public/([^\s?]*) [NC]
RewriteRule ^ %1 [L,NE,R=302]
RewriteRule ^((?!public/).*)$ public/$1 [L,NC]
But my images and js in the src folder are not showing up, any fix, please?
Update
My images and other assets are working now. I just needed to move the assets folder from the src folder to the public folder as well. The src
is working well as well.
CodePudding user response:
You may try this code in your site root .htaccess:
RewriteEngine On
RewriteBase /project-Folder/
RewriteCond %{THE_REQUEST} /public/([^\s?]*) [NC]
RewriteRule ^ %1 [L,NE,R=302]
RewriteRule ^(?!public/|src/).*$ public/$0 [L,NC]
Note that we are now skipping src/
directory from your last rule.