htaccess Elite

.htaccess tutorial


All times are UTC [ DST ]





Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Replacing '%23' in incoming links
PostPosted: 23 Mar 2007 23:32 
Offline

Joined: 30 Oct 2006 19:55
Posts: 99
I had some urls show up in my google sitemaps for one of my sites with "404 Not found" errors for a bunch of urls that had "%23comment-155" looking urls instead of "#comment-155"

So I had to redirect incoming links that contained
Code:
/article.html%23comment-155
to
/article.html#comment-155



The fix:
Code:
RewriteRule ^(.*)\.html([^c]+)comment-(.+)$ http://www.site.com/$1.html#comment-$3 [R=301,L,NE]




Heres what was being requested by browsers as demonstrated by the apache log files.

Code:
"GET /2006/htaccess/speed-up-sites-with-htaccess-caching.html%23comment-155 HTTP/1.1" 200 2617 "-"


Once the fix is in place that same request looks like this.

Code:
"GET /2006/htaccess/speed-up-sites-with-htaccess-caching.html%23comment-155 HTTP/1.1" 301 683 "-"
"GET /2006/htaccess/speed-up-sites-with-htaccess-caching.html HTTP/1.1" 200 24690 "-"


And the users browser is correctly redirected using a Search Engine Friendly 301 Redirect to the correct URL, including the anchor!


For discussion of the problem check out http://www.webmasterworld.com/forum92/5188.htm


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: MSN [Bot], MSNbot Media, Yahoo [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB