• I’m trying to do a simple Apache RewriteRule in a multisite installation and for some reason, it’s having no effect at all. For example, I’d like https://example.com/yourblog/.* to redirect to https://example.com/myblog/.*. So I added this to .htaccess:

    RewriteRule ^yourblog/(.*) myblog/$1

    The rule has no effect at all when I hit https://example.com/yourblog/. I get a 404 error rendered in a WordPress page, as if the rule weren’t there. So something (a 404 handler?) is overriding my URL before the RewriteRule can take effect.

    Even a silly rule like this one has no effect:

    RewriteRule ^yahoo https://www.yahoo.com [R]

    What’s the right way to give a blog site multiple URLs?

    The current .htaccess file is pretty standard.

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [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]

    Thanks for any help.

  • The topic ‘Two URLs for same blog site?’ is closed to new replies.