I've asked a Q about this before but it's not working well.
I have a folder called "listing"
Inside the folder, I have two other main folders called "public" and "src".
Like this...
<pre>
public -> some index.php other pages and files here.
</pre>
<pre>
src -> some backend files and logic here.
</pre>
I want to redirect both the public
and the src
folder to the root directory
So when a user visits the website, instead of localhost/public/index.php, they'll see index.php
I have created the .htacess file and added the following codes to it
RewriteBase /listing/
RewriteCond %{THE_REQUEST} /public/([^\s?]*) [NC]
RewriteRule ^ %1 [L,NE,R=302]
RewriteRule ^((?!public/).*)$ public/$1 [L,NC]
But as you can see, the redirect is only pointing to the public folder. Any way to add the src folder, please? I'm tired of searching lol.
CodePudding user response:
It is still unclear to me what you are asking. If it is to map the src the same way public is working already, then surely you just add these lines to the end
RewriteCond %{THE_REQUEST} /src/([^\s?]*) [NC]
RewriteRule ^ %1 [L,NE,R=302]
RewriteRule ^((?!src/).*)$ src/$1 [L,NC]
Personally, I would just shift the files, unless there is an undisclosed reason for it. If you need them in both places then I would use a symbolic link.