Canonical Redirect Issue
-
I’m having issues with WordPress Multisite. I have it installed on my top level domain and set for non-www. All the pages work fine as long as I don’t enter www in the url, i.e. domain.com, domain.com/post-1, domain.com/post-2 ect…
Whenever I add the www, it always redirects me to my home page homepage, i.e. www.domain.com/post-1, www.domain.com/post-2, www.domain.com/post-3 = all link back to domain.com.
-
You don’t have any redirects in your .htaccess for www, do you?
Options +FollowSymlinks 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]
That’s what is in my .htaccess, I basically just followed the multisite instructions, regular WordPress installs don’t have have this redirect issue, and based on the .htaccess files on the regular install nothing seems different other than the few added rewrite rules. Again I’m really nub to this so any help would be greatly appreciated.
Thanks.
Check with your webhost to see where https://www.domain.com is pointing. It may be a DNS goof. Normally that’s something people control via .htaccess (like I redirect https://www.domain.com back to domain.com, but it keeps all the URLs intact).
The other probable option is that it’s a badly installed plugin.
Figured out the issue, it’s because I changed the permalink structure from /blog/%year%/%monthnum%/%day%/%postname%/ to /%category%/%postname%/
since i omitted the blog part it’s causing redirect issues.
Which leads me to my second question, since i wanted to treat the TLD as a CMS, and add /blog as my blog part, is there any way to do this?
Also I noticed, page permalinks is still an issue, because if I go to domain.com/about/ it works, the second I add www. to the domain it doesn’t redirect to /about/ it goes back to domain.com.
Oh. Yeah, I can see that. How did you remove it from your permalinks? Did you do it this way?
Login to your admin site.
Go to: Super Admin > Sites > Edit
Scroll down to “Permalink Structure” and remove the “/blog” part
Save(By the way, /blog/ is a protected name so I’m not entirely sure you CAN make a blog with that name. The hack may be to make it as blog2 and then go in via the database and change it).
CAVEAT! Remember, by doing this you will BREAK the ability of WordPress to check for conflicts between your main site’s urls and any new site.
That’s exactly how I changed the permalink structure, normally I would have done it through the permalink under the settings tab.
I can work around the /blog part with another sub-directory name, however the issue with the pages redirecting back to homepage is an issue I can’t overlook, since I’m treating the frontpage as a CMS.
I was looking to use WordPress Multisite as a possible solution because I didn’t want to have to make multiple installations of WordPress on multiple databases, but it’s looking more and more that the Multisite feature isn’t going to be a possibility. Unless of course you know the answers to my conundrum :).
No, you CAN do that (I do it that way too ?? ). The problem is weird. I mean, I’ve removed /blog/ a hundred times and never had a problem like yours…
Did you try re-saving permalinks AFTER you changed that?
I went into super admin and changed the permalink structure to /%category%/%postname%/.
I then went into permalinks under the settings sections and click the custom radio button, however the /blog part still shows up, I save it anyways… I load the post and it works with and without the www, however the /blog part shows up in the URL and when I look back at the SuperAdmin settings again, the /blog is put back on again… This is weird.
To top it all off the about page still links back to homepage with the www.
This is really confusing, btw I’ve tried this on two different web hosts.
Okay, clearly it’s not being saved right.
On 3.1 … I went into my site admin and changed it from /blog/ to /foo/ and saved. Then I went to permalinks and it was BLOG/foo/
So okay, that’s weird.
I jumped into the DB and changed
permalink_structure
for the wp_1_options table to just%permalink%
and got the same results.Time to start digging into trac changes!
As for the www reroute changes, search your DB for any calls to www, and ping up your host to ask if THEY have requirements!
Thanks for all your help Ipstenu,
Looks like I’ll just have to install WordPress on seperate databases for now, I’ve wasted quite a bit of time on this already, if this was a personal project I would have spent more time trying to figure it out.
I’ve looked at other WP Multisite’s and they all have the same issue with the pages redirecting back to homepage if www is added. It’s weird no one has noticed this until now lol.
Thanks again,
Doobussomewhat related post here:
https://frumph.net/2010/wordpress/wordpress-3-0-multisite-subdomain-installation-noblogredirect-behavior-fix/Yes, WordPress see yourdomain.com and https://www.yourdomain.com as two separate blogs. because they are.
*headscratch*
Andrea, how come I’ve never had that problem?
I installed at domain.com, so my database all says domain.com (no www). I don’t have any redirects in my .htaccess. I didn’t define noblogredirect.
I have
define( 'DOMAIN_CURRENT_SITE', 'domain.com' );
in my wp-config.php but other than that, https://www.domain.com correctly kicks back on my subdomain blog to domain.comShould I put this in the track? I understand what Andrea_r is saying, but this does not happen on a single WP install.
Please clarify if I’m missing something.
Andrea, how come I’ve never had that problem?
Dunno, I haven’t either, which leads me to think it’s a server side issue.
So we’re back to pinging your webhost and asking if they have anything set on their servers to handle www redirection. Probably something in the httpd.conf file for how it handles subdomains, at a WILD guess…
- The topic ‘Canonical Redirect Issue’ is closed to new replies.