<![CDATA[ Adding Wordpress as a Subdirectory in MODx - My Forums]]> https://forums.modx.com/thread/?thread=49008 <![CDATA[Adding Wordpress as a Subdirectory in MODx]]> https://forums.modx.com/thread/49008/adding-wordpress-as-a-subdirectory-in-modx#dis-post-286317
If you choose to add WordPress to a MODx site (I have a client that insisted on it), and you add WordPress in a subdirectory, the only way I found to maintain friendly URLs in MODx and "pretty urls" in Wordpress is to modify the .htaccess file for MODx in the root directory and add another .htaccess file in the WordPress subdirectory.


For the MODx .htaccess file in the root:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} .

RewriteCond %{HTTP_HOST} !^www\.yoursitename\.com [NC]
RewriteRule (.*) http://www.yoursitename.com/$1 [R=301,L]

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

For the Wordpress .htaccess file in the subdirectory (in my case the subdirectory is titled "blog"):

RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .*/blog/index.php [L]

Don’t forget to turn on the friendly URLs in MODx and the premalinks in Wordpress through the admin interfaces.

AND if anyone else out there has worked with this and sees and issue with my code, please let me know. For now, this solution seems to be working.]]>
ajp1126 Apr 04, 2011, 10:06 PM https://forums.modx.com/thread/49008/adding-wordpress-as-a-subdirectory-in-modx#dis-post-286317