Reputation: 6686
I have a website https://www.mywebsite.it
with a few pages in the root.
Then I have a folder named myapp
where I have an application developed.
Actually the application myapp can be accessed via:
https://www.mywebsite.it/myapp
https://myapp.mywebsite.it
What I want to do is: if the user navigates to https://www.mywebsite.it/myapp apache will redirect him to https://myapp.mywebsite.it
Is something like:
RewriteEngine On
RewriteRule ^/?myapp/ https://myapp.mywebsite.it/? [R=301,L]
inside the vhost configuration file going to work?
Upvotes: 1
Views: 630
Reputation: 785286
Inside myapp/.htaccess
you can use this rule:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(?:www\.)?(mydomain\.it)$ [NC]
RewriteRule .* http://myapp.%1/$0 [L,R=301,NE]
Upvotes: 1