0 votes
in Wordpress by (480 points)
I wanted to run wordpress site on my primary domain but wanted to put all files in a subfolder . It's just for security. How can I achieve it ?

1 Answer

0 votes
by (480 points)
You can easily use your subfolder for wordpress installation & run your website on primary domain .

You can follow few simple steps to do it.

1) Install & configure your wordpress website in a subfolder e.g. example.com/my_subdir

2) Now to run your website on primary domain e.g. example.com, simply  Create a .htaccess file in root folder i.e. directly under public_html, and put following content inside (just change example.com and my_subdir):

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/my_subdir/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /my_subdir/$1
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ my_subdir/index.php [L]
</IfModule>

Now it's done!
Welcome to DNSBOOT.com, where you can ask questions and receive answers from other members of the community.
...