Reputation: 76
I have a site with the following folder structure
/folder1
/folder2/folder3
/othfolder1
/othfolder2
I would like to obtain this
mysite.com -> will show content of /folder1 (without showing the folder on URI, ok for subfolders)
mysite.com/folder3 -> will show content of /folder2/folder3 (without showing folder2 on URI)
mysite.com/othfolderX -> will just remain as it is (/othfolder1 or /othfolder2 or so on), no rewrite
Is this possibile with htaccess rewrite? Will this be any problem with current seo and search results for the site?
Upvotes: 1
Views: 54
Reputation: 785196
You may try these rules in your site root .htaccess:
RewriteEngine On
RewriteRule ^$ folder1/ [L]
RewriteRule ^(folder3)/?$ folder2/$1/ [L,NC]
Make sure you test it after completely clearing your browser cache.
Upvotes: 0
Reputation: 133528
Could you please try following, written as per your shown samples only.
RewriteEngine ON
RewriteCond %{REQUEST_URI} ^/?$
RewriteRule ^.*$ folder1 [L]
RewriteCond %{REQUEST_URI} ^/(folder3)/?$ [NC]
RewriteRule ^(.*) folder2/%1 [L]
Upvotes: 1