For a client that need a re-design and a Plugin that exist only for WordPress I would like to install WordPress in a subdirectory of a website that is built with MODX CMS.

Is this possible to install WordPress into a subdirectory while the website will run normally? Is for test / developing purpose.

Does this cause problems on the MODX installation?

Shall I do something before to start?

In the .htaccess file of the MODX installation I have this:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


  • Are those rewrite rules for MODX? If so that is very similar to the front-controller pattern rules that WordPress uses. So you want your URLs for WordPress to all start with that subdirectory like /blog/this-is-a-wordpress-post/? – Stephen Ostermiller Mar 7 '18 at 12:28
  • @StephenOstermiller the rewrite rules are for MODX. When the develop of the WordPress website is finished I will replace this .htaccess file with the WordPress .htaccess file. – Sazi Mar 7 '18 at 12:38
  • So you want the WordPress site somewhere you can test it for now? If so, I'd run it on a subdomain in another virtual host. It sounds easier than trying to muck with those rewrite rules to get it to work. – Stephen Ostermiller Mar 7 '18 at 12:44

I would like to install WordPress in a subdirectory of a website that is built with MODX CMS.

God, why in the world do you want to do so? Both sites are using htaccess to create SEF urls - you will be never able to correctly debug things if they gett wrong. And in my experience they will. htaccess is very fragil construction dependeing even from an order you write rules into it.

Don't create a source for a guaranteed additional headache. Create a directory on the same directory level as MODx, put Wordpress into it and you are on secure way.

And, for better management, put Wordpress into specially created database - not into the same, where MODx MySQL is placed.

  • But his is exactly what I asked :) I have a folder "www" in this folder there is MODX. Now I want to create in the same folder where MODX is (www) a directory with WordPress. The question was: does this causes problems on the MODX installation? – Sazi Mar 7 '18 at 14:27
  • you question reads, like you have a folder /modx/, and want to create your wordpress installation in /modx/wordpress/. This is a no-go! If you do it like, /www/modx/ and /www/wordpress/ - this is an absolutely correct usage. – Evgeniy Mar 7 '18 at 18:38
  • @Evgeniy true, but most likely modx is installed in document root, not its own modx directory. It would be unwise and a lot of work to move it if OP is getting rid of modx. – Steve Mar 7 '18 at 22:50
  • @Steve yeah, i know, what you mean... There are some cases, where CMS are preinstalled by hosting services or the like - so they are installed into the root. Thats the cause, why i never ever use preinstalled things:) But even in such case i would move everything into own directory on the same level. – Evgeniy Mar 8 '18 at 9:13

The directory structure will be something like /home/user/www (or public_html) and that is where you likely will find modx.

Create a subdomain new.example.com and install wordpress in there. Your wordpress files should be in /home/user/www/new.example.com

You will be able to work on WordPress at new.example.com/wp-admin

When you are done, backup your modx site, delete everything (except the backup and the wordpress directory of course) and move all the files from /home/user/www/new.example.com to /home/user/www/

I find that sometimes it is necessary to go into the dashboard and simply resave permalinks to make it all work properly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.