Problems with WordPress Mod_Rewrite rule in .htaccess file

I am hosting a WordPress website that is using the X theme by Themeco and a third-party plugin to "integrate" The Next Generation of Genealogy Site-Building. Normally I don't have problems doing this, but I have run across an issue I have never seen before. The URL to the site in question is http://www.cadfhs.org. The URL to the TNG pages is http://www.cadfhs.org/member-trees.

What appears to be happening is that the mod_rewrite rule for WordPress is interfering with the display of certain pages. So, if I go to http://www.cadfhs.org/member-trees/surnames.php, The surnames.php part of the URL gets stripped. I have been googling possible solutions and tried several, but to no avail.

The httpd-vhosts.conf file looks like this:

# DOMAIN: cadfhs.org
<virtualhost *:80>
ServerName cadfhs.org
ServerAlias  http://www.cadfhs.org
ServerAdmin jayneclayworth@gmail.com
DocumentRoot "/var/sentora/hostdata/cadfhs/public_html/"
php_admin_value open_basedir "/var/sentora/hostdata/cadfhs/public_html/:/var/sentora/temp/"
php_admin_value suhosin.executor.func.blacklist "passthru, show_source, shell_exec, system, pcntl_exec, popen, pclose, proc_open, proc_nice, proc_termi$
ErrorLog "/var/sentora/logs/domains/cadfhs/cadfhs.org-error.log"
CustomLog "/var/sentora/logs/domains/cadfhs/cadfhs.org-access.log" combined
CustomLog "/var/sentora/logs/domains/cadfhs/cadfhs.org-bandwidth.log" common
<Directory "/var/sentora/hostdata/cadfhs/public_html/">
  Options +FollowSymLinks -Indexes
  AllowOverride All
  Require all granted
</Directory>
AddType application/x-httpd-php .php3 .php
ErrorDocument 510 /_errorpages/510.html
ErrorDocument 403 /_errorpages/403.html
ErrorDocument 500 /_errorpages/500.html
ErrorDocument 404 /_errorpages/404.html
DirectoryIndex index.html index.htm index.php index.asp index.aspx index.jsp index.jspa index.shtml index.shtm
# Custom Global Settings (if any exist)

# Custom VH settings (if any exist)
LogLevel debug rewrite:trace3
</virtualhost>
# END DOMAIN: cadfhs.org
################################################################

The .htaccess file in the root folder has this:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Unfoturnately, I don't know enough about mod_rewrite to figure out the proper syntax for a condition that would ignore/pass through URLs that contain "/member-trees." Any help would be greatly appreciated!

  • Nastia

    Hello HeatherFeuer

    I hope you are doing well today!

    Does these files: surnames.php and other php files, belong to WordPress directory? If they are not, where is their location in the WordPress directory?

    Try to change the line:

    RewriteEngine On
    to this:
    RewriteEngine off

    Will this fix the issue here?

    Would you please let us know, if the WprdPress install located in the subdirectory? This may prevent access URL to folders that located outside the WordPress root.

    Please advise,

    Cheers,
    Nastia.

  • HeatherFeuer

    Hi Nastia,

    Thank you for the prompt response. If I turn the rewrite engine off, permalinks will not work for any page! WordPress is installed in the root directory. The TNG app is installed in a sub-directory called "genealogies." The TNG integration plugin requires that a WordPress page be stipulated as the page where all TNG pages (files) will be displayed. So the plugin knows that TNG data should be displayed on http://www.cadfhs.org/member-trees and that the files required to display this data is in the subdirectory > public_html > genealogies.

    This plugin requires "pretty" permalinks in order to work, so I can't use the default (which would not require an .htaccess file). What I am trying to do is figure out how to do a conditional rule in the rewrite that would allow any url that has the prefix /member-trees/ to be ignored by the rewrite rule that strips index.php. Does that make sense?

  • Sajid

    Hi HeatherFeuer,
    Hope you are doing good today :slight_smile:

    Did you tried adding the .htaccess file in that specific folder and add disable the rewrite engine by modifying the .htaccess ?

    If no then move the .htaccess file in that specific subdirectory file from:
    RewriteEngine On

    To:
    RewriteEngine Off

    The other alternative is to use subdomain for app files instead of subdirectory.

    Hope that helps! Feel free to post a reply if you need further assistance :slight_smile:
    Cheers, Sajid

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.