I have been trying to make a subdomain from a directory (made by .htaccess) to be used as the main page starting like http://domain.com/sub/2/3/4.html
and turning into http://sub.domain.com/2/3/4.html
.
The folder system goes like:
www\sub\2\3\
in www
there is a index.html
and in the sub folder there is a different index.html
.
I currently have this code which I found on another site:
Options -Indexes +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
RedirectMatch 301 ^/sub/(.*)$ http://sub.domain.com/$1
It is successful with changing the domain path to http://sub.domain.com/
, but it is not successful in changing the page shown from the index in the www
directory to the index in the sub directory.
It is also not successful in allowing to open other pages, i.e. not allowing sub.domain.com/2/3/4.html
. If anyone can give any advice it would be much appreciated.