htaccess redirect hide subfolder in url

0 votes

I've looked around and have attempted some rules and conditions that worked; while some did not work or the condition would capture too much causing other domains to also redirect. This works for me:

# Redirect (also catches www.)
RewriteCond %{HTTP_HOST} ^(www.)?$
RewriteRule ^(/)?$ subfolder [L]

resulting in if you visit OR being redirected to Great, but I'dd also like the /subfolder part to be hidden from the url.

How do I achieve this?

Note that I have multiple domains, each should redirect to its own folder. I also want each page to still be visible in its respective folder.

So should redirect to but show

Jul 10, 2018 in AWS by Hammer
• 360 points

1 answer to this question.

0 votes

I found this after searching,

Try this rule:

# remove www
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [NE,R=301,L]

RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$
RewriteRule !^subfolder/ /subfolder%{REQUEST_URI}  [L]

This can be the way to approach.

answered Aug 10, 2018 by Priyaj
• 58,140 points

Related Questions In AWS

+1 vote
0 answers
+3 votes
6 answers

Renaming files in S3

You can either use AWS CLI or ...READ MORE

answered Oct 16, 2018 in AWS by petter dj
+1 vote
4 answers

Can a URL be directly uploaded to S3 using POST?

You can read this blog and get ...READ MORE

answered Oct 25, 2018 in AWS by chamunda
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,140 points
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
0 votes
2 answers

Receiving SMS from users and stores in AWS

As far as I know, receiving international ...READ MORE

answered Aug 21, 2018 in AWS by Priyaj
• 58,140 points
+1 vote
2 answers

How do I get my AWS Glue client in JAVA?

Hey, you've been using a correct code ...READ MORE

answered Apr 17, 2018 in AWS by Cloud gunner
• 4,650 points