As opposed to many questions here in StackOverflow, I’m looking for something a little different. I have a WordPress install in a subfolder of my domain called “blog”. The main part of the website is a Magento website. I’m looking to take any instance where “blog” is part of the URI, and make sure it’s untouched by the myriad of other RewriteRules in Apache.
As a few examples:
http://www.example.com/blog/wp-admin/
http://www.example.com/blog/save-money-groceries-without-coupons/
…should all direct to the WordPress site found under /blog/
http://www.example.com/plumbing/faucets.html
http://www.example.com/about/family-history.html
…should all direct to the Magento site that is currently found under the root directory
What is the best practice in writing the .htaccess file to achieve this result?
To redirect
http://www.example.com/blog/wp-admin/
tohttp://www.blog.example.com/wp-admin/
you can add the following to the .htaccess fileI’m not an expert on setting up Apache servers but I think you want your WordPress install in a completely different folder to Magento and then use
Alias
in your.conf
file. You can read about theAlias
directive here.For example in my Apache .conf files I have
This way the folder
/full/path/to/wordpress/htdocs/
has its own.htaccess
and its ownindex.php
– which is what you are going to want for running WordPress without jumping through hoops.Remember to restart Apache if you update the
.conf
file.