weird www redirect problem

Ok, so this is weird. When i put in http://www.tasartslive.com/pagename it redirects back to tasartslive.com - if i put it in with no www. it takes you to the correct page. Im pretty sure this is something to do with canonical URLs but im not sure where id go to suss out the problem.

In my wp-config its defined like this:

define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
$base = '/';
define( 'DOMAIN_CURRENT_SITE', 'tasartslive.com' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
define('WP_MEMORY_LIMIT', '128M');

should i add the www. to the DOMAIN_CURRENT_SITE? If i do that, will it work without a www. aswell?

Any help appreciated :slight_smile:

Thanks!

  • 3SixtyEvolve
    • New Recruit

    Hi @gogger

    Greetings from the WPMU DEV Support Team and thank you for being a member.

    Yes, as Mustafa said, you have to look into your .htaccess file.

    If you want your site to use www you can edit your .htaccess file in the root of your site and add these lines:

    RewriteEngine On
     RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
     RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

    Let me know if this helps.

    Have a good day!

    GinaB

    ***
    Salam Mustafa. Thank you for your excellent community support. Greatly appreciated.

  • gogger
    • Design Lord, Child of Thor

    Ok so iv modified my .htaccess using the above code but also a few other ways after that made my site not load that i found searching online. This is what i have at the moment - now its back to how it was originally. Links ONLY work as intended without the 'www' - if you put the www infront, it ALWAYS directs to the front page.

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.tasartslive\.tld$ [NC]
    RewriteRule ^(.*)$ http://tasartslive.tld/$1 [R=301,L]
    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).*) $1 [L]
    RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]

  • Mustafa
    • Syntax Hero

    Hi gogger,

    You should modify your dns settings. Enter a Cname record for www and point to 'tasartslive.com.'

    'www' - if you put the www infront, it ALWAYS directs to the front page.

    Check "Banned Names" under the yoursitename.com/wp-admin/network/settings.php. You can see "www" in there.

    Cheers,

  • 3SixtyEvolve
    • New Recruit

    Hi @gogger

    I am quite baffled why you would still have the problem. I will ask some of our senior support team to have a look at your problem, so see if they have any suggestions.

    Also would be interesting to see what Mustafa suggest.

    We will revert back to you soon.

    Have a good day!

    GinaB

    ***
    Salam Mustafa - look forward to your feedback as well, since I can't see why the problem is not yet resolved.

  • Mason
    • DEV MAN’s Sidekick

    Hiya folks,

    This is truly an odd one and the advice above would, in most cases, sort it for you.

    One other thing to give a try is to take the following snippet, save it as a php file and drop it in your plugins folder:

    <?php
    /*
    Plugin Name: Disable Canonical URL Redirection
    Description: Disables the "Canonical URL Redirect" features of WordPress 2.3 and above.
    Version: 1.0
    Author: Mark Jaquith
    Author URI: http://markjaquith.com/
    */ 
    
    remove_filter('template_redirect', 'redirect_canonical'); 
    
    ?>

    Let us know how it goes. It's a bit of a shot in the dark without knowing more about your particular server setup. Thanks!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.