How to make a sub folder site appear as the root website
Previous article Next articleTo have a more organized root folder at my web server I have my personal website installed in a sub folder. Now I have a better overview over all sub websites.
So the CMS Made Simple website is installed in the folder http://www.website.com/www.
But for the primary domain it isn't that nice to have the second www in the pretty URL's. With a .htaccess file you can hide the sub domain name in the URL's. Note this only works on an Apache web server, you sadly can't use a .htaccess file on a Windows server...
How to use
Server root folder
In the root web server folder I made a .htaccess file containing:
RewriteEngine On
RewriteBase /www
# redirect to www-directory and hide the /www in the URL
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule !^www(/?|/.+)$ /www%{REQUEST_URI} [L]
Note: My sub folder is named www. Has your sub folder an other name, change the text www above into your sub folders name!
Server sub folder
The config.php settings of the website are just like a 'regular' CMSMS™ website:
$config['url_rewriting'] = 'mod_rewrite';
In the sub folder I use the default Core .htaccess file. There is NO need to change the RewriteBase
# i.e: RewriteBase /cmsms
RewriteBase /
The described method works for my server setup. It might be that on other servers it doesn't work and you need to change it.
Please post your remarks below and I will update the article to make it more complete!
Comment Form
2 Comments
Hello,
Greetings from Ranker SEO.
Are you looking for a genuine SEO service to rank your website top on Google? Are you cheated by fake SEO companies?
You have found an affordable legitimate SEO agency to rank your website.
We have ranked 100s of websites such as blogs, shopify stores, ecommerce websites, adult websites, saas websites, etc. You can reach more customers by utilizing our backlinks.
For real proof, you can visit our website and check out. Contact us for more details.
Our Skype ID: support@ranker.one
Our Website: https://www.ranker.one
Thanks & Regards
Ranker SEO
If you don't like to receive our messages, you can unsubscribe by click here https://www.ranker.one/unsubscribe/?site=cmscanbesimple.org
I have been searching for this solution for two days. Thank you very much.