Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Google is giving me a crawl error for pages that I have removed like www.mysite.com/mypage.html. I want to redirect this pages to the new page www.mysite.com/mysite/mypage. I tried to do that by using .htaccess but instead of fixing the problem, the crawl pages increased and a new crawl came www.mysite.com/www.mysite.com.

This is my .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /sitename/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /sitename/index.php [L]
</IfModule>
# END WordPress

Should I add this after the rewrite rule or I should do something else?

RewriteRule ^pagename\.html$ http://www.sitename.com/pagename [R=301]
share|improve this question
add comment

2 Answers

Your problem may be to do with that rewritebase command.

Have you checked you redirects to see if they work properly?

I would place my custom redirects above the rewrite block of code. It makes more sense and avoids that rewritebase causing trouble. Just make sure you have a rewriteengine on before it all.

share|improve this answer
    
i tried it but under the rewrite code i will try to add it above it but i am afraid that the website may crash but you mean above all the rewrite rolls even the RewriteEngine On –  sarah Mar 19 '13 at 5:42
    
i tried it before and after RewriteEngine On but nothing happened –  sarah Mar 19 '13 at 5:48
    
RewriteEngine On should always be first. I was talking about the rewritebase command and it's effect on anything after it –  Tiggerito Mar 22 '13 at 15:40
add comment

I prefer to use the Redirect command in .htaccess rather than a rewrite rule for simple redirects:

redirect 301 /pagename.html http://www.sitename.com/pagename

But if you would rather use a rewrite rule, your rule looks like it should be fine.

When I run WordPress, it is more convenient for me to install the Quick Page/Post Redirect Plugin that allows me to specify all the redirects from the WordPress admin interface. I also install the True Google 404 Plugin that keeps track of 404s in the admin interface so I know which redirects to add.

share|improve this answer
    
thanks Stephen Ostermiller for replay i installed the plugin Quick Page/Post Redirect Plugin and redirected a page and opened the page to see if i is redirected or no but it still gives me 401 not found –  sarah Mar 19 '13 at 5:38
    
Not found is 404, 401 is "not authorized". There is something else going on. –  Stephen Ostermiller Mar 19 '13 at 9:31
    
what do you mean by something else ?? this is what appears Not Found The requested URL /servers.html was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Dimofinf Hosting mod_fcgid/2.3.6 Server at www.digitalways.com.sa Port 80 –  sarah Mar 19 '13 at 12:18
    
You had said "401" not "404". Based on the ErrorDocument error message you just pasted in, you also have a problem similar to this one: serverfault.com/questions/299731/… –  Stephen Ostermiller Mar 19 '13 at 12:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.