Mobile app version of vmapp.org
Login or Join
Karen161

: Hiding folders inside root folder using htaccess In my server I have the following folder structure and I want to display each folder project link without the folder name. How can I do this?

@Karen161

Posted in: #Htaccess #ModRewrite

In my server I have the following folder structure and I want to display each folder project link without the folder name. How can I do this?

Root Folder
-> Subfolder1
-> Project folder 1
-> Project folder 2
-> Subfolder2
-> Project folder 3
-> Project folder 4
-> Subfolder3
-> Project folder 5


I want to display my project URL without the subfolder, ie:
domain.com/project folder 1 domain.com/project folder 2
etc....

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Karen161

1 Comments

Sorted by latest first Latest Oldest Best

 

@Alves908

You need to know the relationship between the project-folder and the sub-folder, ie. which sub-folder a particular project is in. If there is no pattern between project-folder and sub-folder and being restricted to .htaccess then I think you'll need to specify each rewrite manually.

You can internally rewrite all requests for the respective project to include the appropriate sub-folder.

RewriteEngine On

RewriteRule ^project-folder1.* /sub-folder1/[CO] [L]
RewriteRule ^project-folder2.* /sub-folder1/[CO] [L]
RewriteRule ^project-folder3.* /sub-folder2/[CO] [L]
# etc...


Note that this is an internal rewrite, not an external redirect, the URL in the address bar won't show the sub-folder.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme