Lelio Faieta Lelio Faieta - 1 year ago 193
Apache Configuration Question

htaccess redirect folder to a third level domain

I have a website

with a few pages in the root.

Then I have a folder named
where I have an application developed.
Actually the application myapp can be accessed via:


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?

Answer Source

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]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download