Forum Moderators: phranque
But now I have new static pages with a different urls like:
mysite.com/somedir/somedir/54980.htm
I need a 301 redirect that removes "/remove-text-2" for all my pages so the new url become: mysite.com/somedir/somedir/54980.htm
So I think I need a htaccess rule that looks at the uri and send a 301 redirect to our new urls for the search engines..
Well I hope you understand my question and can help me
Thanks again
There have been at least two similar questions in the last 48 hours, so a perusal of old threads here should find plenty of examples to get you started. We can help you fix your code, but at the end of the day anything you add to your server configuration file must be fully understood by you so that you can maintain it in the future.
AddType text/html .shtml .html .htm
AddHandler server-parsed .shtml .html .htm
(This make the old urls still working when they came from google)
<Files *xml>
ForceType application/x-httpd-php
</Files>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com [nc]
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
[edited by: jdMorgan at 5:48 pm (utc) on Jan. 13, 2010]
[edit reason] example.com [/edit]
So you need to add a RewriteRule that removes the unwanted path-part, and place it *before* your domain canonicalization rule:
# Externally redirect requests for URL-path "/somedir/somedir/<numbers>/<any-text>.htm"
# to "http://www.example.com/somedir/somedir/<numbers>.htm"
RewriteRule ^somedir/somedir/([0-9]+)/[^.]+\.htm$ http://www.example.com/somedir/somedir/$1.htm [R=301,L]
Jim
There is only one little problem.. this /<numbers>/ don't exist as directory on my server, so I had to create for every <numbers> an map on my server..
I am not sure if this is possible, but is there no rule that looks at the uri... Or will this return as a bad 301 ?
No you didn't. You should have reported the problem here instead.
You've got some other code somewhere that is grabbing these requests before the rule can get control.
Try adding
AcceptPathInfo off
Options +FollowSymLinks -MultiViews
Also, only include the "AcceptPathInfo off" directive if you're on Apache 2.x -- It will cause an error if you try to use it on Apache 1.3 or earlier.
If this doesn't help, then please let us know if you've used a 'control panel' to install any blog, forum, or shopping cart, or to make any other URL-affecting settings changes.
Jim
Actually, I don't think you could possibly see any effect on traffic this soon. Wait until your logs show that google has spidered all of these pages twice before you even start to worry about such things. And as the code appears to be correct, there's really nothing to worry about: Your traffic may drop for a few weeks, but should return to normal after that. The drop has to do with the time needed for google to 'assign' the PageRank of your old URLs to your new URLs, and that can only be done after at least one complete crawl cycle.
> And how long will it take before google update my links?
A few weeks, a few months, or not until October, 2010 -- It all depends on how frequently googlebot crawls your site, and how much it trusts and esteems your site... The index should update at about the same time you see the second of two complete crawl cycles.
Jim