dimanche 26 février 2017

Q: Website HTACCESS Canonical 301 Redirect Code Assistance Needed

My Website is for Web Design purposes, so it is a Single-Page Site (just my Home page)..
However, by SEO standards, there are still multiple url's that land at the same homepage.

I have already set the rel="canonical" tag in the head, but still need to set 301 redirects
to point to my Canonical URL at http://www.example.com/
Keep in mind I want the www, as well as the trailing forward slash "/"..

My CPanel isnt capable, so I've concluded I need to add the code to my HTaccess file.

MY GOAL: Redirect traffic that lands on any of the following url's, to my Canonical URL..
example.com
example.com/
http://ift.tt/2lT3iYi
www.example.com
http://ift.tt/1s8YSqc

TO MY CANONICAL AT: http://www.example.com/

MY PREVIOUS ATTEMPTS:
I attempted in part using my cPanel, but it ended up looking like this:
RewriteEngine On RewriteCond %{HTTP_HOST} ^example\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.example\.com$ RewriteRule ^default\.html$ "http\:\/\/www\.example\.com\/" [R=301,L]

I also read a popular SEO Site's article, suggesting using:
RewriteEngine On RewriteCond %{HTTP_HOST} ^example\.com RewriteRule (.*) http://ift.tt/VAk5HC [R=301,L] NOTE: Some Versions of Apace require an extra line or two of code for SymLinks and a different structure of the rewrite rule as follows: RewriteEngine On Options +FollowSymlinks RewriteBase / RewriteCond %{HTTP_HOST} ^example\.com$ [NC] RewriteRule ^(.*)$ http://ift.tt/VAk5HC [R=301,L]

MY QUESTION:
For what I listed as my GOAL above, which is redirecting anybody landing on ANY of those URL's, to my preferred Canonical URL (also listed above), what EXACTLY would be the CORRECT code I should enter into my HTaccess file, to accomplish this?

HUGE Thank you to anybody who can assist me with this..
Thanks in advance, It's much appreciated..

-B

PS. I've checked the reccomended related links on this site, and the ones i've found are mostly related to forcing HTTPS and/or a separate goal than mine.
Thanks again in advance for any help provided!




Aucun commentaire:

Enregistrer un commentaire