Https redirect adds subdirectory to URL

Hi,

I'm running into a weird problem.
Whenever our site redirects, it adds a subdirectory in the URL name.

For example,

The url: http://simplymusicteachers.com/store/products

is redirected to our secure store:
https://simplymusicteachers.com/store/products

However, when accessing the first link, it redirects to:

https://simplymusicteachers.com/~NAME/store/products.

This happens with every url when it is redirected. The source of the problem seems to come from our .htaccess file:

# 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

Any ideas what could be causing this?
Thanks

  • Vaughan
    • Support/SLS MockingJay

    hiya

    thanks for the post.

    are you using multisite?

    if so, it looks like you have not edited the htaccess file when you turned your site into a network.

    your htaccess looks like its from a single site.

    should look more like this >

    RewriteEngine On
    RewriteBase /
    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]

    hope this helps

    thanks.

  • simplymusic
    • Site Builder, Child of Zeus

    Hey Vaughan,

    Thanks for the reply.
    Yes, we've tried regenerating permalinks with no luck.
    Here is the wp-config.php file:

    <?php
    /** Enable W3 Total Cache */
    // Added by W3 Total Cache

    /**
    * The base configurations of the WordPress.
    *
    * This file has the following configurations: MySQL settings, Table Prefix,
    * Secret Keys, WordPress Language, and ABSPATH. You can find more information
    * by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
    * wp-config.php} Codex page. You can get the MySQL settings from your web host.
    *
    * This file is used by the wp-config.php creation script during the
    * installation. You don't have to use the web site, you can just copy this file
    * to "wp-config.php" and fill in the values.
    *
    * @package WordPress
    */

    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', 'DATABASE');

    /** MySQL database username */
    define('DB_USER', 'USERNAME');

    /** MySQL database password */
    define('DB_PASSWORD', 'PASSWORD');

    /** MySQL hostname */
    define('DB_HOST', 'HOST');

    /** Database Charset to use in creating database tables. */
    define('DB_CHARSET', 'utf8');

    /** The Database Collate type. Don't change this if in doubt. */
    define('DB_COLLATE', '');

    /**#@+
    * Authentication Unique Keys and Salts.
    *
    * Change these to different unique phrases!
    * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
    * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
    *
    * @since 2.6.0
    */
    define('AUTH_KEY', 'put your unique phrase here');
    define('SECURE_AUTH_KEY', 'put your unique phrase here');
    define('LOGGED_IN_KEY', 'put your unique phrase here');
    define('NONCE_KEY', 'put your unique phrase here');
    define('AUTH_SALT', 'put your unique phrase here');
    define('SECURE_AUTH_SALT', 'put your unique phrase here');
    define('LOGGED_IN_SALT', 'put your unique phrase here');
    define('NONCE_SALT', 'put your unique phrase here');

    /**#@-*/

    /**
    * WordPress Database Table prefix.
    *
    * You can have multiple installations in one database if you give each a unique
    * prefix. Only numbers, letters, and underscores please!
    */
    $table_prefix = 'wp_';

    /**
    * WordPress Localized Language, defaults to English.
    *
    * Change this to localize WordPress. A corresponding MO file for the chosen
    * language must be installed to wp-content/languages. For example, install
    * de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German
    * language support.
    */
    define('WPLANG', '');

    /**
    * For developers: WordPress debugging mode.
    *
    * Change this to true to enable the display of notices during development.
    * It is strongly recommended that plugin and theme developers use WP_DEBUG
    * in their development environments.
    */
    define('WP_DEBUG', false);

    /* Multisite */
    define('WP_ALLOW_MULTISITE', true);

    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', true);
    define('DOMAIN_CURRENT_SITE', 'simplymusicteachers.com');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);

    /* Multisite Cross Site Users */
    if(!defined('MEMBERSHIP_GLOBAL_TABLES'))
    define( 'MEMBERSHIP_GLOBAL_TABLES', true);
    if(!defined('MEMBERSHIP_GLOBAL_MAINSITE'))
    define( 'MEMBERSHIP_GLOBAL_MAINSITE', 1);

    define( 'MEMBERSHIP_PAGE_COUNT', 100);

    /* That's all, stop editing! Happy blogging. */

    /** Absolute path to the WordPress directory. */
    if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');

    /** Sets up WordPress vars and included files. */
    require_once(ABSPATH . 'wp-settings.php');

  • Vaughan
    • Support/SLS MockingJay

    hiya

    it seems i might have given you the wrong htaccess.

    could you possibly try this instead?

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
    RewriteRule ^(.*\.php)$ wp/$1 [L]
    RewriteRule . index.php [L]

    failing that it could be an SSL issue & you may need to reinstall the SSL cert.

    hope this helps

  • simplymusic
    • Site Builder, Child of Zeus

    Thanks for the reply.

    I updated the htaccess and found the root of the problem.
    We had a popular SSL plugin force SSL to all non-ssl visitors and for some reason it was redirecting wrong.

    After disabling the plugin, the problem went away.
    Thanks for the help

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.