• Resolved Joe Bloggs

    (@joe-bloggs)


    Hey guys,

    I really love your plugin, but recently came across to a couple of issues and wondering if there’s a way to fix it.

    I started using the GTranslate plugin for automated Google translation. The plugin adds a few rewrite rules to the .htaccess to create the subdirectory structure for the URL’s like this:

    ### BEGIN GTranslate config ###
    RewriteRule ^(af|sq|am|ar|hy)/(.*)$ /$1/$3 [R=301,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(af|sq|am|ar|hy)/(.*)$ /wp-content/plugins/gtranslate/url_addon/gtranslate.php?glang=$1&gurl=$2 [L,QSA]
    RewriteRule ^(af|sq|am|ar|hy)$ /$1/ [R=301,L]
    ### END GTranslate config ###

    But now Security Optimiser causes these URL’s such as ‘ domain.com/af ‘ inaccessible resulting in 403 error.

    Is there any way to go about this?

    Many thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Delyan Delov

    (@delyandelov)

    Hi @joe-bloggs,

    Unfortunately, I am unable to recreate the issue you are experiencing because the GTranslate plugin is a paid one. However, the issue is most probably caused by the rules added by our plugin to the wp-content/.htaccess file:

    <FilesMatch "\.(?i:php)$">
    <IfModule !mod_authz_core.c>
    Order allow,deny
    Deny from all
    </IfModule>
    <IfModule mod_authz_core.c>
    Require all denied
    </IfModule>
    </FilesMatch>

    You can easily exclude the Gtranslate PHP file from the above rules by adding the following code at the end of the wp-content/.htaccess file:

    <FilesMatch "gtranslate\.php$">
    Require all granted
    </FilesMatch>

    This way the WordPress content will be protected and the Gtranslate plugin will work properly.

    Regards,
    Delyan Delov

    Thread Starter Joe Bloggs

    (@joe-bloggs)

    Thanks so much Delyan.

    Added the lines as suggested:

    # SGS Directory Hardening
    <FilesMatch "\.(?i:php)$">
    <IfModule !mod_authz_core.c>
    Order allow,deny
    Deny from all
    </IfModule>
    <IfModule mod_authz_core.c>
    Require all denied
    </IfModule>
    </FilesMatch>
    # SGS Directory Hardening END

    # Exclude GTranslate
    <FilesMatch "gtranslate\.php$">
    Require all granted
    </FilesMatch>
    # Exclude GTranslate END

    All works now! Thanks again.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Blocks GTranslate rewrite rules in .htaccess’ is closed to new replies.