Currently my URL is like http://vidleap.com/nov5and151/index.html and now I want to redirect this URL like http://nov5and151.vidleap.com/index.html. So how to do it via htaccess?
I am using below code but it's not working.
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
RewriteCond %{HTTP_HOST} ^(?:www\.)?vidleap\.com [NC]
RewriteRule ^([^/]+)(/.*)?$ http://www.$1.vidleap.com$2 [R=301,L,NC]
RewriteCond %{HTTP_HOST} ^www\.(.+)\.vidleap\.com [NC]
RewriteRule ^(.*)$ /%1/$1 [L]
</IfModule>
Try these rules in different order:
Make sure to clear your browser cache.
You can try these :-