Forum Moderators: phranque
I have been through the threads and charter on it, but this one hasn't been covered anywhere as far as I can tell.
If you have this in your htaccess:
redirect 301 /example/ [mysite.com...]
and in Google, your site is mentioned as:
www.mysite.com/ example/
when the visitor clicks on it they get:
[mysite.com...]
I'm under the impression, through reading many threads here on these excellent forums, that it's good to end on a / as this is slightly quicker for the visitor, but in the above example, it causes the error shown. A lot of the visitors to the website are on dialup, so speed is very important.
Looking through Googles links to us, some of them end with / and some of them don't.
Is there any way that a rule can be done, so that it doesn't put an extra / at the end if there's already one?
If you need any more info to be able to help, please let me know. I've been battling with this for a few weeks and could really do with a hand ;-)
Sev.
I've been all through the code in the .htaccess file and can't see anything else that would cause it ;-(
If it's any help, when I put this:
redirect 301 /example/ [mysite.com...]
I don't end up with // at the end of the url?
Also, am I right in saying that the visitor gets the new page quicker if there's a / at the end? Very important as the users are mostly on dialup.
Your helps appreciated.
Sev.
Been through it all thoroughly again and all I can see that might cause a problem, is that in Google, they have this:
[mysite.com...]
and this:
[mysite.com...]
So, to cover that, I have this in my .htaccess:
redirect 301 /oldexample/ [mysite.com...]
redirect 301 /oldexample [mysite.com...]
when the visitor clicks on it they should get:
[mysite.com...]
But the problem, is that if they click on the wrong one in Google, they get:
[mysite.com...]
Also, am I right in saying that the visitor gets the new page quicker if there's a / at the end? Very important as the users are mostly on dialup.
Looking through Googles links to us, some of them end with / and some of them don't.
If you need any more info to be able to help, please let me know. I've been battling with this for a few weeks and could really do with a hand ;-)
Any help appreciated.
Sev.
A review of the Redirect documentation [httpd.apache.org] will explain the reason; Redirect uses prefix-matching, not exact matching.
I'd suggest deleting them and using:
RewriteRule ^oldexample/?$ http://www.mysite.com/newexample/ [R=301,L]
RedirectMatch 301 ^/oldexample/?$ http://www.mysite.com/newexample/
Yes, the user gets the page faster if a redirect is not required. A 301 redirect response terminates the current client HTTP request, and instructs the client to re-request the desired resource at the new URL included in that response. So the browser has to issue a second HTTP request to get the content it requested from the incorrect URL.
However, once you have a proper 301-redirect in place, this problem will go away in a few weeks, since the search engines will update the URLs they show for your site to include the trailing slash.
Jim
Don't worry, all of the advice you gave was just perfect ;-), but I'm just a little curious about this particular one, as I can't seem to get it to work ;-(
Not sure if there's anything that anyone can do about this, but in my awstats I get a heck of a lot of 404's
on:
/example%20example
But when I put this in my .htaccess:
RewriteRule ^/example%20example/?$
[newsite.com...] [R=301,L]
It doesn't solve the problem, even though the same thing definitely works with the other 'error' pages?
Any ideas how I can get it to work at all please?
All the best.
Sev.
Been very pleased with what you explained to me earlier ;-) But, 1 particular rule is really causing a problem, before I really got to grips with file names, I had a heavily hyphenated one, that is still in some SE's and when I put this in the .htaccess, it doesn't work:
RewriteRule ^example-example-example-example.html
[example.co.uk...] [R=301,L]
But this one does:
RewriteRule ^example-example-example.html
[example.co.uk...] [R=301,L]
Do you know if there's another way to it all please?
All the best.
Sev.