`I am using the WPML plugin for multilingualism,
I’m having a problem because of All In One WP Security & Firewall
When anyone changes the language on the site to English Then back to the original language , the site crashes and the following appears
”
500 Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
”
The site is down for a long time
it makes the change in the .htaccess file
As soon as the code is modified, the site works without a problem, then as soon as you change the language, the code changes again
************************Before *******************
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /en/
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /en/index.php [L]
</IfModule>
This code is correct and the site works without a problem and the previous code site becomes disabled
************************Corrected rule ********************************
<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>
https://wpml.org/errata/htaccess-is-rewritten-with-language-folder/
I found here a description of the problem and a way to solve it temporarily, then I tried to go back to the old versions All In One WP Security & Firewall 4.4.9 and it solve the problem
I’m facing the issue with the custom link which I have generated using “add_rewrite_tag” and “add_rewrite_rule” WP functions.
The custom link automatically stopped working after updating the WP version to 5.5 and it was working perfectly in the past version of 5.4.2 and 5.4.1 so, I think the latest version(5.5) is having a bug related to rewrite rules.
Kindly suggest.
Thanks,
Priyanka
Now I want some of these blogs to be accessible under other domain names, e.g. Blog 1 under otherdomain.tld. What’s the proper way to configure redirections and site URLs in this case?
I have followed the official WordPress multisite documentation. The DNS entries are set up, in the provider’s domain configuration I have pointed the otherdomain.tld domain at the /wp/
directory, and in the WordPress blog itself I have set set the site URL to https://otherdomain.tld.
All sites on the multisite work fine as long as I open them under https://domain.tld. When I open https://otherdomain.tld in the browser, Blog 1 also opens as it should; however, when I try to login into Blog 1 (open wp-login.php), open its admin panel (open wp-admin.php) or do anything else that directly leads to a PHP file, I get a browser error ERR_TOO_MANY_REDIRECTS
. Now when I do anything else on the Blog 1, open any link or post, I get a 500 Internal Server Error with the following message in httpd-error.log:
[Wed Feb 26 12:31:07.551961 2020] [core:error] [pid 13360:tid 34388520448] [client X.X.X.X:41006] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: https://otherdomain.tld/
I think the loop might be related to the RewriteRule /wp/
entry in .htaccess
, but I’m not sure.
Here is the .htaccess file (in the /wp/
directory):
RewriteEngine On
RewriteBase /wp/
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
And here is the relevant section in wp-config.php
(as you can see, I’ve already tried different versions of the COOKIE_DOMAIN
and related options – side note: enabling any of these leads to PHP warnings about duplicate definitions in the WP debug log):
/* Multisite */
define( 'WP_ALLOW_MULTISITE', true );
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'domain.tld');
define('PATH_CURRENT_SITE', '/wp/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
/* some other entries in between */
define('COOKIE_DOMAIN', $_SERVER['HTTP_HOST']); /* recommended by WordPress */
/* define( 'COOKIE_DOMAIN', '' ); /* often recommended online, doesn't work */
define( 'ADMIN_COOKIE_PATH', '/' );
define( 'COOKIEPATH', '/' );
define( 'SITECOOKIEPATH', '/' );
/* Cookie configuration from https://www.ads-software.com/support/article/editing-wp-config-php/:
define('COOKIEPATH', preg_replace( '|https?://[^/]+|i', '', get_option( 'home' ) . '/' ) );
define('SITECOOKIEPATH', preg_replace( '|https?://[^/]+|i', '', get_option( 'siteurl' ) . '/' ) );
define('ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
define('PLUGINS_COOKIE_PATH', preg_replace( '|https?://[^/]+|i', '', WP_PLUGIN_URL ) );
*/
]]>In such a case the adaptive_images_plugin_get_htaccess_file_path() which uses get_home_path() does not detect the .htaccess where it is (one directory up).
I’d add that adaptive_images_plugin_file_permissions() should go away for overcomplexity. Using is_writable() should be enough.
Lastly, the .htaccess-is-ok routing should rather check the presence of the Rewrite itself
RewriteRule.*(jpeg|png).*plugins/adaptive-images/adaptive-images-script.php
rather than the enclosing comments.
thank you
]]>I want to display in an old url a new template I use for a new custom post type but I dont manage to set up correctly .htaccess.
Before I had: mysite.com/product-page-b
now I have created a CPT so I have mysite.com/products/product-page-b
I managed to rank very well in google serps for mysite.com/product-page-b so I dont want to even 301 to the new url but would like to use the template I have for my “products” cpt (products-single.php) since it has a better layout for that given product and want to replace the old one that is using single.php.
.htaccess RewriteRule is supposed to do it but I don find the way. For 301 is easy
RewriteRule ^products/product-page-b/(.*)$ /product-page-b/$1 [R,L]
but this is not the point in my case.
I have tried to use the rewrite before and after the “#begin … end wordpress#” code.
Any suggestion here? I have searched a lot in internet but found nothing about this precise case.
Thanks
]]># 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
I want to have a link such as www.mydomain.com/client1/brochure/
and I want it to rewrite so that it goes to: www.mydomain.com/client-work/?id=client1&work=brochure and keeping the original link www.mydomain.com/client1/brochure/ in the address bar.
I have tried:
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /client-work/?id=$1&work=$2 [L]
and this does keep the www.mydomain.com/client1/brochure/ in the address bar however i get a sorry page not found error.
I have tried:
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /client-work?id=$1&work=$2 [L]
which is the same as the first example but without the forward slash after client-work. This goes to the right permalink page – great! However in the address bar it now looks like: www.mydomain.com/client-work/?id=client1&work=brochure. Isn’t this redirecting as opposed to rewriting?
I guess this is ok but when I do rewriteRules on non wordpress sites I can keep the nice url in the address bar.
Any help would be greatly appreciated. Thanks
]]>The workaround is easy: visit Settings->Permalinks and click Save.
Unfortunately, if anyone with edit access to the site messes with a gallery and doesn’t remember to save Permalinks afterward, we’re left with a gallery full of 404s.
I’ve isolated the what but I can’t translate that into why yet. It seems like something about editing the gallery is resulting in a reset of wp_rewrite->rules without the merged ruleset from RewriteRules, but how could that happen?
]]>This works:
RewriteRule ^test/([0-9][0-9])/$ /test?test_id=$1
Thid does not:
RewriteRule ^test/([0-9][0-9])/([0-9])$ /test?test_id=$1$name=$2
It works on a normal site, but something with the second forward slash is not working…
Does anyone know how to make custom rewrites with wordpress…and WPMU?
`
]]>This project is dedicated to the best .htaccess and apache htaccess tutorials, guides, and documentation. Helpful cheatsheets, underground apache mailing-lists, webmaster forums, mod_rewrite online samples, etc. This is for all the awesome server configurations and Apache hacks.