Reputation: 185
I try to add the following logic to a .htaccess file:
subdomain.domain.xx make a redirect to subdomain.domain.xx/subdomain/ xy.domain.xy redirect to xy.domain.xy/xy/ (it should work with every subdomain without adding new rewrites)
i found a lot of solutions to redirect subdomain.domain.xx -> domain.xx/subdomain, but nothing like i need... below you find the code i try out.
Hope someone can help me. Thanks.
RewriteEngine on RewriteBase /
RewriteRule ^([^.?]+[^.?/])$ $1/ [R]
RewriteCond %{HTTP_HOST} ^(www)?.domain.ch/$ RewriteRule .* http\://%1$1.domain.ch/%1$1 [I,R=301]
Upvotes: 0
Views: 201
Reputation:
Place this in the .htaccess
file of your subdomain's root directory:
DirectoryIndex index.html
RewriteEngine on
Redirect permanent /index.html http://subdomain.domain.xx/subdomain/
Upvotes: 1