RewriteRule in .htaccess inconsistent on Multisite
-
I have 14 sites set up and working fine. I’ve been developing the new sites by pointing the domains in my local /etc/hosts file. Almost ready to launch now, so I’m finishing up by implementing rewrite rules from the prior site (it was done with ColdFusion) to the same pages on the new site.
Trouble is, I’m finding a few things don’t work properly.
Am I correct in that, for .htaccess rules to work, they have to be added to .htaccess and also to a custom rewrite_rules_array filter?
So far that is the only way I’ve been able to get them working.
Example:
# in .htaccess RewriteRule foo index.php?pagename=about [R=301,L] # in mytheme/functions.php function my_rewrite_rules( $rewrite_rules ) { $new_rules = array( 'foo' => 'index.php?pagename=about' ); $rewrite_rules = $new_rules + $rewrite_rules; return $rewrite_rules; } add_filter('rewrite_rules_array', 'my_rewrite_rules');
Without both rules in both places, the rule doesn’t work.
Now here’s where it gets real confusing. When I try to rewrite the old link index.cfm?fuseaction=this.that to a WP page, it fails completely. I’ve tried
# in .htaccess RewriteRule foo index.php?pagename=about [R=301,L] RewriteRule index\.cfm\?fuseaction=this\.that index.php?pagename=this-that [R=301,L] # in mytheme/functions.php function my_rewrite_rules( $rewrite_rules ) { $new_rules = array( 'foo' => 'index.php?pagename=foo', 'index\.cfm\?fuseaction=this\.that' => 'index.php?pagename=this-that' ); $rewrite_rules = $new_rules + $rewrite_rules; return $rewrite_rules; } add_filter('rewrite_rules_array', 'my_rewrite_rules');
and several other forms to no avail. I just get a “WordPress 404 page” every time. In short, certain redirects appear to be working fine, others do not. So, based on the examples above, this works:
multisite.com/foo (shows the about page as expected)
multisite.com/index.php?pagename=this-that (shows the this-that page)
multisite.com/this-that (shows the this-that page … yes, I am using /%postname% for permalinks)
multisite.com/index.cfm?fuseaction=this.that (404)Any suggestions?
- The topic ‘RewriteRule in .htaccess inconsistent on Multisite’ is closed to new replies.