Caconical URL Redirecting..

I can see that this thread went well off its topic :p :lol:
 
Really?
What makes you say that? :D

Anyway I thought it was in DF's forum rules to make threads go off topic after they have been answered? I mean it wouldn't be DF if it didn't, now would it? :D
 
hah, now i feel a bit better, i dont speak programmer-ish and i can only speak pidgin javascript. but i do speak real french. :)
I have an OCD when it comes to learning something new, I tend to get a tad obsessed so.
Same! I have too much of a hands on impatient approach though..

Anyhoo for example if you had this set up ~
<link rel="canonical" href="http://yoursite.com/" />

And then needed to write 1 for a particular article, which IMO it should be used for, you would then need 2 so ~
<link rel="canonical" href="http://yoursite.com/" />
<link rel="canonical" href="http://yoursite.com/dir1/article" />

So set up the www. via the htaccess/server files and then if you have a copy of a file link to the correct file via the link tag with the canonical attribute to tell the search engines that the article is a copy.

Does that make more sense Emma? :)
youre going to want to strangle me but uhm.. can i just check ive got this right..

According to the way i read how to implement it, youd just put the <link rel="canonical" href="http://yoursite.com/" /> on your index page, and the <link rel="canonical" href="http://yoursite.com/dir1/article" /> on the article page, and you wouldnt need to have two ever within the same page..

Am i right in thinking what i just said is correct if i wanted to do this on a static site, but the site being a blog where you put that canonical tag within your header.php file, so would appear on all pages, is the only reason why id ever end up needing to put two of these tags in (on the article page, id need one for the individual article, whilst the one for the index page is still there..)

So, given that its a blog, I do this instead:

1) Use the redirect code within .htaccess for the main url, AND the canonical url tag (my plugin all-in-one seo pack says itll do this for me), for individual pages.

2) Just use the redirect code within .htaccess


..Sorry!
 
Hay don't be sorry.
Forget ~
<link rel="canonical" href="http://yoursite.com/" />
Just 301 redirect it using .htaccess.

If you then have similar files with similar content then use the tag on 1 of those pages. Does that make sense?

If you don't have pages with similar content forget about it. :)

You can speak French?
Wow impressed.
 
Okay! I understand now :D Thanks so much for your patience.. and yeah, A at A Level :D But it seems to only be when I go to France and have no choice that my brain can be bothered to remember all i learned..
 
I know, ignorant eh :) .. I think they actually prefer us shouting really loud at them in a slight yet very poor French accent.

Heh. I had a thought about that canonical URL tag.. does it actually redirect? If not, I suppose if someone wanted to link to you, there is nothing stopping them from copying and pasting the non-canonical URL.. right? So if thats true, in that case canonical url tag is rubbish.. no?
 
ohh.. sorry jaz but i added that redirect code in so the whole .htaccess file looked like this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^reachingmorepeople.co.uk [NC]
RewriteRule ^(.*)$ http://reachingmorepeople.co.uk/$1 [R=301, L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


#----- START DAP -----
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} (.*)/wp-content/uploads/(.*)
RewriteRule (.*) /dap/client/website/dapclient.php?dapref=%{REQUEST_URI}&plug=wp&%{QUERY_STRING} [L]
#----- END DAP -----

</IfModule>


Options -Indexes
I visited the WWW version and got 'Internal Server Error'.. any ideas why? :S

Emma
 
I know :) I actually participated in discussion here yesterday too hahah. But I'll know when I'm any good - I'll be able to rip Google analytics apart in a few paras like I can a bad pose or amateur lighting heh.

And it does now! Im not sure how that happened :) I just reuploaded the old htaccess:

Code:
<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]#----- START DAP -----RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} (.*)/wp-content/uploads/(.*) RewriteRule (.*) /dap/client/website/dapclient.php?dapref=%{REQUEST_URI}&plug=wp&%{QUERY_STRING}  [L] #----- END DAP -----</IfModule>Options -Indexes
Thats the only thing thats in there.. maybe its the all-in-one-seo pack..I really dont know actually which is kinda disconcerting :S

I tried to do a more simple redirect with a new, blank .htaccess file on a static site yesterday, and got an internal server error. I just pasted this into a .rtf file and saved it as .htaccess:

Code:
RewriteEngine OnRewriteCond %{HTTP_HOST} ^thebestmusicshop.co.uk [NC]RewriteRule ^(.*)$ http://www.thebestmusicshop.co.uk/$1 [L,R=301]

I put that into public_html folder, and then got an internal server error:

"Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, root@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log."


Do you have any idea why this is? :S
 
Well that looks right, I just downloaded 1 I wrote and looked at it and it's fine, just incase I was going mad. :(

This seo-in-one pack can you explain it in more detail?
As you shouldn't have an issue with that code TBH.

Personally though it is redirecting so it's probably the pack that is doing it, just look at the packs documentation to make sure the redirect is a 301 and not a 302 or 307 and you shouldn't need it.

O and congrats on the contribution sweets. :)
 
If it is doing it and you didn't set it up ask them they might just be good TBH. But make sure it is a 301 redirect, that's important. :)
 
oh no the plugin is doing the redirecting i think :) but I was asking do you think the problem with my 301 redirect you coded is due to server settings or maybe where im placing it as in my last post?
 
If u are placing it in the root folder (public_html) it should be fine. I would say it is probably the seo pack u then upload the .htaccess file theres a conflict n thus an error. If it's redirecting, check the seo packs documentation to see if it is that, if u cant find it contact your hosting, they could have set it up maybe. But my moneys on the seo pack tbh.
 
okay, i checked that same redirect on some static sites hosted in the same place, that have no plugins or bits and pieces added on. I still got the 500 internal server error.

I used a few different versions of it rather than the one you sent which was more specific to the .htaccess i currently have in the blog. I pasted this:

Code:
RewriteEngine onRewriteCond %{HTTP_HOST} ^thebestmusicshop.co.ukRewriteRule ^(.*)$ http://www.thebestmusicshop.co.uk/$1 [R=301,L]

into a blank .htaccess file and uploaded it to the root folder, public_html.

It gave me the error again.

I then read this at http://www.webconfs.com/how-to-redirect-a-webpage.php:
Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.

could the issue be my server? im told the sites are hosted on a linux server..
 
I would find it hard to believe that they haven't enabled url rewriting TBH, but it could. A 500 error is what you get when a server spits out an error so it is a server error TBH. The NC flag (nc) just means no-case so if you typed in YouRSite.com it would still redirect it's best to put that in.

Email your hosting and see what they say about it. :)
 
Hay I was thinking about your problem and I realised it might be my fault, okay no it is. You need the match end of character $ which I told you to take out. Whoops yeah I'm a dumbass. So it should look like ~

RewriteEngine On
RewriteCond %{HTTP_HOST} ^thebestmusicshop.co.uk$ [NC]
RewriteRule ^(.*)$ http://www.thebestmusicshop.co.uk/$1 [L,R=301]

That will explain the 500 error TBH.

Jaz :eek:

First time I've used that smiley face. :)

Key:
Brown ~ Mod_Rewrite
 
not to worry jaz it was my fault too :) There were RTF headers within the file apparently - I didnt see them in my text editing prog :S What do you usually do to check theres no headers like this in a htaccess file?
 
Back
Top