Welcome to WebmasterWorld Guest from 54.161.105.39

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

htaccess Settings with MaxCDN

CDN, SEO, htaccess

     
3:48 am on Apr 9, 2014 (gmt 0)

Junior Member

10+ Year Member

joined:Apr 14, 2005
posts: 62
votes: 0


Hi all,

I need help on setting up MaxCDN. There's a tutorial in MaxCDN about adding canonical tags using .htaccess for SEO purposes. I'm kinda dumb on this and need some advice/ help on what's all this about. From the code I can guess that it instructs .htaccess to label all those cached file with canonical tag. But that's my guess. I need some verifications from you expert. (to correct whatever wrong you see)

Currently my site is optimized by Yoast WordPress SEO and I can see the plugin adding canonical tag on every pages. Therefore do I need those extra code in .htaccess as recommended in MaxCDN's tutorial?

Below is the code, and here is the link to the tutorial page - [support.maxcdn.com...]

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|webp|html)(\.gz)?(\?.*)?$">
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule .* - [E=CANONICAL:http://%{HTTP_HOST}%{REQUEST_URI},NE]
RewriteCond %{HTTPS} =on
RewriteRule .* - [E=CANONICAL:https://%{HTTP_HOST}%{REQUEST_URI},NE]
</IfModule>
<IfModule mod_headers.c>
Header set Link "<%{CANONICAL}e>; rel=\"canonical\""
</IfModule>
</FilesMatch>


Any guidance/ words would be much appreciated. Thanks for your time!
10:00 am on Apr 9, 2014 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10857
votes: 67


this solves nothing for you.
it creates an environment variable based on the requested url and uses that to create a self-referring link rel canonical header.
if the requested url is already canonical it doesn't need the header.
you could argue that it makes sense to include self-referring link rel canonical elements in the document head to reduce damage from scrapers.
this solution instead sends the header, which is transient, rather than the element, which is permanent.
11:55 am on Apr 9, 2014 (gmt 0)

Junior Member

10+ Year Member

joined:Apr 14, 2005
posts: 62
votes: 0


Do you mean it actually creates a canonical tag with the value "the cached file path" which is absolutely differ from the original file path?
3:40 pm on Apr 9, 2014 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10857
votes: 67


Do you mean it actually creates a canonical tag with the value "the cached file path" which is absolutely differ from the original file path?

i would assume those instruction were for your server and the request your server sees is not "the cached file path".

http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritecond
REQUEST_URI

The path component of the requested URI, such as "/index.html". This notably excludes the query string which is available as as (sic) its own variable named QUERY_STRING.

this increases the chances that it might not be the canonical url, which may actually contain a query string.