We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 742
    • 12 Posts
    OK I am adding this in here because I didn’t find the answer in MODx Forums when I looked for it, and I found a solution through some trial and error through a few other Wordpress focused pages. I hope this helps someone =)

    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.