• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question Who or what is changing my htaccess file

Robert Alexander

Basic Pleskian
Hi
For a few weeks I've been having problems on one of my domains.
Inside the domain is an invisionpower set of forums. They work fine, as long as a line in my .htaccess file (in the root dir of my domain) is commented out or deleted.
I have no idea what keeps changing it.

Here's the file info and at the bottom in GREEN, is the line ## out and doesn't cause a problem
What happens is the ## can be automatically removed intermittently and if I delete the line, it gets written in again, without ##
The File Permissions are set at 444, but when it's overwritten the file permissions get set to 666

So my problem is what or who is changing this and can it be resolved?
Thanks

# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
# Prevent Direct Access Rewrite Rules
RewriteRule private/([a-zA-Z0-9]+)$ index.php?pda_v3_pf=$1 [L]
RewriteCond %{REQUEST_FILENAME} -s
RewriteCond %{HTTP_USER_AGENT} !facebookexternalhit/[0-9]
RewriteCond %{HTTP_USER_AGENT} !Twitterbot/[0-9]
RewriteCond %{HTTP_USER_AGENT} !Googlebot/[0-9]
RewriteRule wp-content/uploads/_pda(\/[A-Za-z0-9_@.\/&+-]+)+\.([A-Za-z0-9_@.\/&+-]+)$ index.php?pda_v3_pf=$1&is_direct_access=true&file_type=$2 [QSA,L]
# Prevent Direct Access Rewrite Rules End
# Prevent Direct Access Prevent Hotlinking Rules
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^CLub La Costa Members – Independent Club La Costa Product Advice [NC]
RewriteRule \.(gif|jpg|jpeg|bmp|zip|rar|mp3|flv|swf|xml|png|css|pdf)$ - [F]
# Prevent Direct Access Prevent Hotlinking Rules End

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
##RewriteRule . /index.php [L]
</IfModule>
Options -Indexes

# END WordPress
 
Hi,

WordPress (or a plugin) is altering the contents of your .htaccess file between the BEGIN and END directives:

# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.

You could perform a grep on the commandline and search for "##RewriteRule", that might give some inside which plugin changes your .htaccess file.
 
Hi,

WordPress (or a plugin) is altering the contents of your .htaccess file between the BEGIN and END directives:

# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.

You could perform a grep on the commandline and search for "##RewriteRule", that might give some inside which plugin changes your .htaccess file.
Thanks for that. I've got ptty to run root command lines. Is there a specific command syntax I need to get correct, given also that the file in question resides in a particular domain on the Server? Would appreciate knowing what to write exactly? Thanks
 
I wrote grep -r RewriteRule *
I received this below. What can I tell from that?
parallels/PSA_17.8.11/microupdates/MU19/common/admin/conf/templates/default/domain/domainVirtualHost.php: RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,QSA]
[root@server ~]#
 
Hi,

You should run it from the folder where the .htacces file is located.

Just to be sure I'll understand your problem: this is the default WordPress .htaccess file:

Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

What exactly doesn't work on your website? Is there anything odd in the error_log or proxy_error_log files?
 
Well I found out how to get to the Directory and did this [root@server ~]# grep -r RewriteRule *

Does anyone know what I'm looking for, to solve the problem?


parallels/PSA_17.8.11/microupdates/MU19/common/admin/conf/templates/default/doma in/domainVirtualHost.php: RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI } [R=301,L,QSA]
[root@server ~]# parallels/PSA_17.8.11/microupdates/MU19/common/admin/conf/templates/default/doma in/domainVirtualHost.php: RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI } [R=301,L,QSA]
[root@server ~]#
-bash: parallels/PSA_17.8.11/microupdates/MU19/common/admin/conf/templates/default/doma: No such file or directory
[root@server ~]# [root@server ~]#
-bash: [root@server: command not found
[root@server ~]# find . -name .htaccess
[root@server ~]# /var/www/vhosts/clcmembers.co.uk/httpdocs
-bash: /var/www/vhosts/clcmembers.co.uk/httpdocs: Is a directory
[root@server ~]# cd /var/www/vhosts/clcmembers.co.uk/httpdocs
[root@server httpdocs]# grep -r RewriteRule
.htaccesstoday:RewriteRule private/([a-zA-Z0-9]+)$ index.php?pda_v3_pf=$1 [L]
.htaccesstoday:RewriteRule wp-content/uploads/_pda(\/[A-Za-z0-9_@.\/&+-]+)+\.([A-Za-z0-9_@.\/&+-]+)$ index.php?pda_v3_pf=$1&is_direct_access=true&file_type=$2 [QSA,L]
.htaccesstoday:RewriteRule \.(gif|jpg|jpeg|bmp|zip|rar|mp3|flv|swf|xml|png|css|pdf)$ - [F]
.htaccesstoday:RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
.htaccesstoday:RewriteRule ^index\.php$ - [L]
.htaccesstoday:RewriteRule . /index.php [L]
.htaccessreallyold:RewriteRule private/([a-zA-Z0-9]+)$ index.php?pda_v3_pf=$1 [L]
.htaccessreallyold:RewriteRule wp-content/uploads/_pda(\/[A-Za-z0-9_@.\/&+-]+)+\.([A-Za-z0-9_@.\/&+-]+)$ index.php?pda_v3_pf=$1&is_direct_access=true&file_type=$2 [QSA,L]
.htaccessreallyold:RewriteRule \.(gif|jpg|jpeg|bmp|zip|rar|mp3|flv|swf|xml|png|css|pdf)$ - [F]
.htaccessreallyold:RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
.htaccessreallyold:RewriteRule ^index\.php$ - [L]
.htaccessreallyold:RewriteRule . /index.php [L]
archive/.htaccess:RewriteRule \.(jpeg|jpg|gif|png)$ /forum/public/404.php [NC,L]
archive/.htaccess:RewriteRule . /forum/index.php [L]
.htaccessnew:RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
.htaccess:RewriteRule private/([a-zA-Z0-9]+)$ index.php?pda_v3_pf=$1 [L]
.htaccess:RewriteRule wp-content/uploads/_pda(\/[A-Za-z0-9_@.\/&+-]+)+\.([A-Za-z0-9_@.\/&+-]+)$ index.php?pda_v3_pf=$1&is_direct_access=true&file_type=$2 [QSA,L]
.htaccess:RewriteRule \.(gif|jpg|jpeg|bmp|zip|rar|mp3|flv|swf|xml|png|css|pdf)$ - [F]
.htaccess:RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
.htaccess:RewriteRule ^index\.php$ - [L]
.htaccess:##RewriteRule . /index.php [L]
.htaccess161221:RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
.htaccess161221:RewriteRule private/([a-zA-Z0-9]+)$ index.php?pda_v3_pf=$1 [L]
.htaccess161221:RewriteRule wp-content/uploads/_pda(\/[A-Za-z0-9_@.\/&+-]+)+\.([A-Za-z0-9_@.\/&+-]+)$ index.php?pda_v3_pf=$1&is_direct_access=true&file_type=$2 [QSA,L]
.htaccess161221:RewriteRule \.(gif|jpg|jpeg|bmp|zip|rar|mp3|flv|swf|xml|png|css|pdf)$ - [F]
.htaccess161221:RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
.htaccess161221:RewriteRule ^index\.php$ - [L]
.htaccess161221:RewriteRule . /index.php [L]
forum/modules/gallery/admin/ad_tools.php: $to_write .= "RewriteRule \.(gif|jpg|jpeg|png|GIF|JPG|JPEG|PNG)$ {$replace}";
forum/sources/components_acp/gallery/ad_tools.php: $to_write .= "RewriteRule \.(gif|jpg|jpeg|png|GIF|JPG|JPEG|PNG)$ {$replace}";
forum/api/htaccess:RewriteRule .* index.php [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
forum/.htaccess:RewriteRule \.(jpeg|jpg|gif|png)$ /forum/public/404.php [NC,L]
forum/.htaccess:RewriteRule . /forum/index.php [L]
forum/applications/core/modules/admin/promotion/seo.php:RewriteRule \\.(js|css|jpeg|jpg|gif|png|ico|map|webp)(\\?|$) {$dir}404error.php [L,NC]
forum/applications/core/modules/admin/promotion/seo.php:RewriteRule . {$path} [L]
forum/applications/core/modules/admin/applications/api.php:RewriteRule .* index.php [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
forum/admin/applications_addon/ips/gallery/modules_admin/tools/tools.php: $to_write .= "RewriteRule \.(gif|jpg|jpeg|png|GIF|JPG|JPEG|PNG)$ {$replace}";
forum/admin/sources/classes/class_admin_functions.php: $rules .= "RewriteRule \.(jpeg|jpg|gif|png)\$ {$_root}public/404.php [NC,L]\n\n";
forum/admin/sources/classes/class_admin_functions.php: "RewriteRule . {$_root}index.php [L]\n";
forum/admin/applications/core/skin_cp/cp_skin_templates.php:RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
[root@server httpdocs]# grep -r RewriteRule
.htaccesstoday:RewriteRule private/([a-zA-Z0-9]+)$ index.php?pda_v3_pf=$1 [L]
.htaccesstoday:RewriteRule wp-content/uploads/_pda(\/[A-Za-z0-9_@.\/&+-]+)+\.([A-Za-z0-9_@.\/&+-]+)$ index.php?pda_v3_pf=$1&is_direct_access=true&file_type=$2 [QSA,L]
.htaccesstoday:RewriteRule \.(gif|jpg|jpeg|bmp|zip|rar|mp3|flv|swf|xml|png|css|pdf)$ - [F]
.htaccesstoday:RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
.htaccesstoday:RewriteRule ^index\.php$ - [L]
.htaccesstoday:RewriteRule . /index.php [L]
.htaccessreallyold:RewriteRule private/([a-zA-Z0-9]+)$ index.php?pda_v3_pf=$1 [L]
.htaccessreallyold:RewriteRule wp-content/uploads/_pda(\/[A-Za-z0-9_@.\/&+-]+)+\.([A-Za-z0-9_@.\/&+-]+)$ index.php?pda_v3_pf=$1&is_direct_access=true&file_type=$2 [QSA,L]
.htaccessreallyold:RewriteRule \.(gif|jpg|jpeg|bmp|zip|rar|mp3|flv|swf|xml|png|css|pdf)$ - [F]
.htaccessreallyold:RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
.htaccessreallyold:RewriteRule ^index\.php$ - [L]
.htaccessreallyold:RewriteRule . /index.php [L]
archive/.htaccess:RewriteRule \.(jpeg|jpg|gif|png)$ /forum/public/404.php [NC,L]
archive/.htaccess:RewriteRule . /forum/index.php [L]
.htaccessnew:RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
.htaccess:RewriteRule private/([a-zA-Z0-9]+)$ index.php?pda_v3_pf=$1 [L]
.htaccess:RewriteRule wp-content/uploads/_pda(\/[A-Za-z0-9_@.\/&+-]+)+\.([A-Za-z0-9_@.\/&+-]+)$ index.php?pda_v3_pf=$1&is_direct_access=true&file_type=$2 [QSA,L]
.htaccess:RewriteRule \.(gif|jpg|jpeg|bmp|zip|rar|mp3|flv|swf|xml|png|css|pdf)$ - [F]
.htaccess:RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
.htaccess:RewriteRule ^index\.php$ - [L]
.htaccess:##RewriteRule . /index.php [L]
.htaccess161221:RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
.htaccess161221:RewriteRule private/([a-zA-Z0-9]+)$ index.php?pda_v3_pf=$1 [L]
.htaccess161221:RewriteRule wp-content/uploads/_pda(\/[A-Za-z0-9_@.\/&+-]+)+\.([A-Za-z0-9_@.\/&+-]+)$ index.php?pda_v3_pf=$1&is_direct_access=true&file_type=$2 [QSA,L]
.htaccess161221:RewriteRule \.(gif|jpg|jpeg|bmp|zip|rar|mp3|flv|swf|xml|png|css|pdf)$ - [F]
.htaccess161221:RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
.htaccess161221:RewriteRule ^index\.php$ - [L]
.htaccess161221:RewriteRule . /index.php [L]
forum/modules/gallery/admin/ad_tools.php: $to_write .= "RewriteRule \.(gif|jpg|jpeg|png|GIF|JPG|JPEG|PNG)$ {$replace}";
forum/sources/components_acp/gallery/ad_tools.php: $to_write .= "RewriteRule \.(gif|jpg|jpeg|png|GIF|JPG|JPEG|PNG)$ {$replace}";
forum/api/htaccess:RewriteRule .* index.php [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
forum/.htaccess:RewriteRule \.(jpeg|jpg|gif|png)$ /forum/public/404.php [NC,L]
forum/.htaccess:RewriteRule . /forum/index.php [L]
forum/applications/core/modules/admin/promotion/seo.php:RewriteRule \\.(js|css|jpeg|jpg|gif|png|ico|map|webp)(\\?|$) {$dir}404error.php [L,NC]
forum/applications/core/modules/admin/promotion/seo.php:RewriteRule . {$path} [L]
forum/applications/core/modules/admin/applications/api.php:RewriteRule .* index.php [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
forum/admin/applications_addon/ips/gallery/modules_admin/tools/tools.php: $to_write .= "RewriteRule \.(gif|jpg|jpeg|png|GIF|JPG|JPEG|PNG)$ {$replace}";
forum/admin/sources/classes/class_admin_functions.php: $rules .= "RewriteRule \.(jpeg|jpg|gif|png)\$ {$_root}public/404.php [NC,L]\n\n";
forum/admin/sources/classes/class_admin_functions.php: "RewriteRule . {$_root}index.php [L]\n";
forum/admin/applications/core/skin_cp/cp_skin_templates.php:RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
2nd part to follow...
 
2nd part...
Binary file wp-content/ai1wm-backups/clcmembers.co.uk-20190605-215908-718.wpress matches
wp-content/plugins/really-simple-ssl/testssl/serverhttpxforwardedsslon/.htaccess:RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
wp-content/plugins/really-simple-ssl/testssl/serverhttps1/.htaccess:RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
wp-content/plugins/really-simple-ssl/testssl/serverhttpxforwardedssl1/.htaccess:RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
wp-content/plugins/really-simple-ssl/testssl/envhttps/.htaccess:RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
wp-content/plugins/really-simple-ssl/testssl/loadbalancer/.htaccess:RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
wp-content/plugins/really-simple-ssl/testssl/serverport443/.htaccess:RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
wp-content/plugins/really-simple-ssl/testssl/serverhttpxproto/.htaccess:RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
wp-content/plugins/really-simple-ssl/testssl/serverhttpson/.htaccess:RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
wp-content/plugins/really-simple-ssl/testssl/cloudflare/.htaccess:RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
wp-content/plugins/really-simple-ssl/testssl/cloudfront/.htaccess:RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI} [L]
wp-content/plugins/really-simple-ssl/class-admin.php: $pattern = "/(\[OR\])(?!.*(\[OR\]|#start).*?RewriteRule)/s";
wp-content/plugins/really-simple-ssl/class-admin.php: $pattern = '/RewriteRule \^\(\.\*\)\$ https:\/\/%{HTTP_HOST}(\/\$1|%{REQUEST_URI}) (\[R=301,.*L\]|\[L,.*R=301\])/i';
wp-content/plugins/really-simple-ssl/class-admin.php: $rule .= "RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]" . "\n";
wp-content/plugins/really-simple-ssl/lets-encrypt/class-letsencrypt-handler.php: $rules .= 'RewriteRule ^.well-known/(.*)$ - [L]'."\n";
wp-content/plugins/really-simple-ssl/lets-encrypt/vendor/fbett/le_acme2/README.md: RewriteRule \.well-known/acme-challenge/(.*)$ https://your-domain.com/path/to/acme-challenges/$1 [R=302,L]
wp-content/plugins/prevent-direct-access/includes/views/autoload_view.php: $rewrite_rule_loc = sprintf(wp_kses(__('<strong>in the WordPress rewrite block</strong> (the WordPress block usually starts with %s and ends with %s, <strong>just below</strong> the line reading %s', 'prevent-direct-access'), array( 'strong' => array() ), false), '<code># BEGIN WordPress</code>', '<code># END WordPress</code>', '<code>RewriteRule ^index\.php$ - [L]</code>');
wp-content/plugins/prevent-direct-access/includes/views/autoload_view.php: $rewrite_rule_loc = sprintf(wp_kses(__('<strong>within your WordPress rewrite block</strong>, which usually starts with %s and ends with %s, and <strong>just below</strong> the line reading %s', 'prevent-direct-access'), array( 'strong' => array() ), false), '<code># BEGIN WordPress</code>', '<code># END WordPress</code>', '<code>RewriteRule ^index\.php$ - [L]</code>');
wp-content/plugins/prevent-direct-access/prevent-direct-access.php: $newRule .= "RewriteRule private/([a-zA-Z0-9]+)$ " . $downloadFileRedirect;
wp-content/plugins/prevent-direct-access/prevent-direct-access.php: // eg. RewriteRule wp-content/uploads(/[a-zA-Z_\-\s0-9\.]+)+\.([a-zA-Z0-9]+)$ index.php?pre_dir_acc_61co625547=$1&is_direct_access=true&file_type=$2 [QSA,L]
wp-content/plugins/prevent-direct-access/prevent-direct-access.php: $newRule .= "RewriteRule " . str_replace( trailingslashit( $site_url ), '', $upload_dir_url ) . "/_pda" . "(\/[A-Za-z0-9_@.\/&+-]+)+\.([A-Za-z0-9_@.\/&+-]+)$ " . $directAccessPath;
wp-content/plugins/prevent-direct-access/prevent-direct-access.php: 'RewriteRule \.(gif|jpg|jpeg|bmp|zip|rar|mp3|flv|swf|xml|png|css|pdf)$ - [F]',
wp-content/plugins/backupbuddy/classes/restore.php:RewriteRule ^index\\.php$ - [L]
wp-content/plugins/backupbuddy/classes/restore.php:RewriteRule . /index.php [L]
wp-content/plugins/backupbuddy/classes/restore.php: } elseif ( strstr( $line, 'RewriteRule' ) ) { // RewriteRule.
wp-content/plugins/backupbuddy/classes/restore.php: } elseif ( ! strstr( $line, 'RewriteRule . ' ) ) {
wp-content/plugins/backupbuddy/classes/restore.php: $new_line = 'RewriteRule . ' . $paths['rewrite_path'] . 'index.php [L]' . "\n";
wp-content/plugins/backupbuddy/classes/restore.php: if ( false !== strstr( $line, 'RewriteRule . ' ) ) { // RewriteRule, warn user potentially if path may need changed.
wp-content/plugins/backupbuddy/classes/restore.php: pb_backupbuddy::status( 'warning', 'User-defined RewriteRule found and WordPress path has changed so this rule MAY need manually updated by you to function properly. Line #' . $line_number . ': "' . $line . '".' );
clcstaging/.htaccessnew:RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
clcstaging/.htaccess:RewriteRule ^index\.php$ - [L]
clcstaging/.htaccess:RewriteRule . /clcstaging/index.php [L]
clcstaging/wp-content/plugins/wordfence/lib/wordfenceClass.php: RewriteRule .* - [F,L,NC]
clcstaging/wp-content/plugins/really-simple-ssl/class-admin.php: $pattern = "/(\[OR\])(?!.*(\[OR\]|#start).*?RewriteRule)/s";
clcstaging/wp-content/plugins/really-simple-ssl/class-admin.php: $needle_old = "RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]";
clcstaging/wp-content/plugins/really-simple-ssl/class-admin.php: $needle_new = "RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]";
clcstaging/wp-content/plugins/really-simple-ssl/class-admin.php: $rule .= "RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]" . "\n";
clcstaging/wp-content/plugins/seo-redirection-premium/options/option_redirect_SSL.php:RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]"
clcstaging/wp-content/plugins/backupbuddy/classes/restore.php:RewriteRule ^index\\.php$ - [L]
clcstaging/wp-content/plugins/backupbuddy/classes/restore.php:RewriteRule . /index.php [L]
clcstaging/wp-content/plugins/backupbuddy/classes/restore.php: } elseif ( strstr( $line, 'RewriteRule' ) ) { // RewriteRule.
clcstaging/wp-content/plugins/backupbuddy/classes/restore.php: } elseif ( ! strstr( $line, 'RewriteRule . ' ) ) {
clcstaging/wp-content/plugins/backupbuddy/classes/restore.php: $new_line = 'RewriteRule . ' . $paths['rewrite_path'] . 'index.php [L]' . "\n";
clcstaging/wp-content/plugins/backupbuddy/classes/restore.php: if ( false !== strstr( $line, 'RewriteRule . ' ) ) { // RewriteRule, warn user potentially if path may need changed.
clcstaging/wp-content/plugins/backupbuddy/classes/restore.php: pb_backupbuddy::status( 'warning', 'User-defined RewriteRule found and WordPress path has changed so this rule MAY need manually updated by you to function properly. Line #' . $line_number . ': "' . $line . '".' );
clcstaging/wp-includes/class-wp-rewrite.php: $rules .= "RewriteRule ^index\.php$ - [L]\n";
clcstaging/wp-includes/class-wp-rewrite.php: $rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA,L]\n";
clcstaging/wp-includes/class-wp-rewrite.php: "RewriteRule ^.*$ - [S=$num_rules]\n";
clcstaging/wp-includes/class-wp-rewrite.php: $rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA,L]\n";
clcstaging/wp-includes/class-wp-rewrite.php: $rules .= 'RewriteRule ^' . $match . ' ' . $site_root . $query . " [QSA,L]\n";
clcstaging/wp-includes/class-wp-rewrite.php: "RewriteRule . {$home_root}{$this->index} [L]\n";
clcstaging/wp-admin/includes/network.php: $ms_files_rewriting = "\n# uploaded files\nRewriteRule ^";
clcstaging/wp-admin/includes/network.php:RewriteRule ^index\.php$ - [L]
clcstaging/wp-admin/includes/network.php:RewriteRule ^{$subdir_match}wp-admin$ {$subdir_replacement_01}wp-admin/ [R=301,L]
clcstaging/wp-admin/includes/network.php:RewriteRule ^ - [L]
clcstaging/wp-admin/includes/network.php:RewriteRule ^{$subdir_match}(wp-(content|admin|includes).*) {$rewrite_base}{$subdir_replacement_12} [L]
clcstaging/wp-admin/includes/network.php:RewriteRule ^{$subdir_match}(.*\.php)$ {$rewrite_base}$subdir_replacement_12 [L]
clcstaging/wp-admin/includes/network.php:RewriteRule . index.php [L]
clcstaging/.htaccessold:RewriteRule ^index\.php$ - [L]
clcstaging/.htaccessold:RewriteRule . /index.php [L]


3rd part to follow:.
 
3rd part..

wp-includes/class-wp-rewrite.php: $rules .= "RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]\n";
wp-includes/class-wp-rewrite.php: $rules .= "RewriteRule ^index\.php$ - [L]\n";
wp-includes/class-wp-rewrite.php: $rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA,L]\n";
wp-includes/class-wp-rewrite.php: "RewriteRule ^.*$ - [S=$num_rules]\n";
wp-includes/class-wp-rewrite.php: $rules .= 'RewriteRule ^' . $match . ' ' . $home_root . $query . " [QSA,L]\n";
wp-includes/class-wp-rewrite.php: $rules .= 'RewriteRule ^' . $match . ' ' . $site_root . $query . " [QSA,L]\n";
wp-includes/class-wp-rewrite.php: "RewriteRule . {$home_root}{$this->index} [L]\n";
wp-admin/includes/network.php: $ms_files_rewriting = "\n# uploaded files\nRewriteRule ^";
wp-admin/includes/network.php:RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
wp-admin/includes/network.php:RewriteRule ^index\.php$ - [L]
wp-admin/includes/network.php:RewriteRule ^{$subdir_match}wp-admin$ {$subdir_replacement_01}wp-admin/ [R=301,L]
wp-admin/includes/network.php:RewriteRule ^ - [L]
wp-admin/includes/network.php:RewriteRule ^{$subdir_match}(wp-(content|admin|includes).*) {$rewrite_base}{$subdir_replacement_12} [L]
wp-admin/includes/network.php:RewriteRule ^{$subdir_match}(.*\.php)$ {$rewrite_base}$subdir_replacement_12 [L]
wp-admin/includes/network.php:RewriteRule . index.php [L]
 
Hi,

You should run it from the folder where the .htacces file is located.

Just to be sure I'll understand your problem: this is the default WordPress .htaccess file:

Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

What exactly doesn't work on your website? Is there anything odd in the error_log or proxy_error_log files?

Well as stated at the beginning that second last line..
RewriteRule . /index.php [L] ... if left like that, my forums will not work. So I have to put # in front of it, or even remove it, but something intermittenly comes back and adds that line back or if I've got a # in front of it, the # is removed.

It's as if someone doesn't want to have that line with the hash, or want's it to stay as in your quote, so that my forums don't work.

I'm the only admin on the site/server.
 
I think you should focus on the problem why the forums won't work with the default RewriteRules, but I understand it's annoying that the .htaccess file gets changed automatically.

What if you change the File Permissions to 400?
 
I think you should focus on the problem why the forums won't work with the default RewriteRules, but I understand it's annoying that the .htaccess file gets changed automatically.

What if you change the File Permissions to 400?
Understand, but the Forums are a completely separate product and I can place them inside any website, as I have a licence. However, they only redirect you to your host, which is me.

I've tried the 400 now. Lets see if that works. Thanks
Robert
 
Ok, so what if you enable the "Take over wp-cron.php" option in the WordPress Toolkit:

Screenshot 2022-02-02 at 16.16.16.png
and disable the "Create a replacement task":

Screenshot 2022-02-02 at 16.23.54.png
 
Ok. It hasn't worked. I tried to access the forums again this morning, and it didn't work. I checked the file and the # was gone and the file permission was changed to 666.
I replaced it again and changed file to 444.

It's all working again. Any other thoughts. It's a real challenge.
 
In wp-admin/includes/network.php you'll find the htaccess lines that are written between the BEGIN and END markers. Just search on "htaccess_file".

It's not the best way to hack this, but you could try to change it in that file. As long as the file isn't altered due to an upgrade, it should work I guess.
 
Back
Top