homepage Welcome to WebmasterWorld Guest from 54.166.108.167
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
htaccess Settings with MaxCDN
CDN, SEO, htaccess
Lowkei




msg:4661725
 3:48 am on Apr 9, 2014 (gmt 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!

 

phranque




msg:4661767
 10:00 am on Apr 9, 2014 (gmt 0)

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.

Lowkei




msg:4661787
 11:55 am on Apr 9, 2014 (gmt 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?

phranque




msg:4661830
 3:40 pm on Apr 9, 2014 (gmt 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?

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved