redirection icon indicating copy to clipboard operation
redirection copied to clipboard

Redirects through .htaccess on multisite

Open idarek opened this issue 6 years ago • 4 comments

Summary

By default, when using the plugin with Apache Groups in Wordpress Multisite to write redirects to .htaccess it create redirects that are applicable to all websites (URLs) rather than only to the main URL where the plugin is activated an in use.

<IfModule mod_rewrite.c> RewriteCond %{HTTPS} off RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} RewriteRule ...

Actual Behavior

Will be nice if plugin detects a multisite environment and add to the rule RewriteCond to apply to specific WordPress domain rather than to all of them. Think it is HTTP_HOST.

Idea example: RewriteCond %{HTTP_HOST} ^(www\.)?domain\.fr$ [NC] RewriteRule ^(|fr)$ http://www.domain.com/fr/france [R=301,L]

And then under there will be RewriteRules as in plugin.

In that situation, Single .htaccess will be able to accommodate multiple instances of Apache redirect for different domains in a multisite environment.

Environment

Wordpress Multisite

References

https://wordpress.org/support/topic/redirects-through-htaccess-on-multisite/

idarek avatar Dec 09 '18 19:12 idarek