Hi there Sitepoint,
This is my first post in this forum, and I am not that good with .htaccess. Please bear with me.
I have searched around the sitepoint.com and have tried the solutions, but none works.
So here is my situation.
I have a website, say the name is mydomain.com
mydomain.com is using CMS, so that there are several non-existent directory, such as “about” in www.mydomain.com/home/about/thissite.html
The problem is that I need to make this subdomain:
so that whenever people type “sub.mydomain.com”
- they get the content of www.mydomain.com/home/id/ (where “id” is non-existent directory)
- but the URL bar at the top still displays sub.mydomain.com (hence this is not 301 redirect)
it is just one particular subdomain (in this example, it is “sub”), not any subdomains.
that means if I type “sub.mydomain.com/something.html” (must be “html”), then I will get the content of
www.mydomain.com/home/id/something.html
with “sub.mydomain.com/something.html” still displayed at the top.
In addition to the info above, this is the current .htaccess:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .*\.html$ index.php [L]
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteCond %{REQUEST_URI} !^/home/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /home/$1
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteRule ^(/)?$ home/index.php [R=301,L]
so that if user type “mydomain.com” they will be redirected to “mydomain.com/home/index.php”
What should I do to solve this?
Do I have to make a subdomain “sub” in the cPanel, or non-existent/virtual subdomain is also fine?
I have done many trials and errors for 2 days and I still havent managed to solve this. frustrated
Please help
Regards,
Ryonn