Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Changing the ULR (with or without www) causes dead links in activity stream.

@icepin

Participant

Tried, didn’t worked.
If anyone will ever need this, the trick is done via .htaccess file.

RewriteCond %{HTTP_HOST} !^www\..* [NC]
RewriteRule ^ http://www.domain.com%{REQUEST_URI} [R=301,L]

So, explained, if your blog/BP network has old links without www. and you recently changed the website URL to http://www.domain.com because you started using a CDN, this will help you to get you’re whole network back with no dead links. Tested on all sides, no errors.

my .htaccess file looks like this:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} !^www\..* [NC]
RewriteRule ^ http://www.domain.com%{REQUEST_URI} [R=301,L]

RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Credits:
– http://www.456bereastreet.com/archive/200601/search_engines_and_canonical_urls/
– the most awesome hosting company support for tweaking the code (KnownHost)

Cheers! 🙂

Skip to toolbar