Jump to content

Changed URLs & have 404 errors. How to fix it?


alainB

Recommended Posts

Hi,

 

I changed some URLs and now, I have the 404 errors "page not found" using some links.

Please, don't throw tomatoes or eggs on me, I know: I was stupid to do that, sorry! :facepalm:

 

I kept the old URLs names. Can I fix it? With a 301 redirection? (I never did that and not sure how to do) or something else?

I have 3 pages like that, on WordPress.

 

Can i add some code somewhere? and if some people saved the old link, they arrive on the new URL?

 

Thanks for your help!! :good:

Link to comment
Share on other sites

  • 2 weeks later...

Sorry, I couldn't do it well. So maybe can I show here what I have exactly?

 

My .htaccess

 

# BEGIN WorldPress

 

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /blog/

RewriteRule ^index\.php$ - [L]

Rewrite Cond %{REQUEST_FILENAME} !-f

Rewrite Cond %{REQUEST_FILENAME} !-d

Rewrite Rule . /blog/index.php [L]

</IfModule>

# END WorldPress

 

The same page:

old url = http://www.loveyourstay.com/blog/property/domaine-du-mas-sangha/

new url = http://www.loveyourstay.com/blog/property/location-vacances-argeles-sur-mer-piscine-jardin/

 

1/ So, the problem of course is that people who kept the old link arrive on a 404 error "page not found" . I would like they arrive on the good one.

2/ I would like to keep the PageRank etc

2/ Is it possible that Google don't show anymore the obsolete page in the results, but only the new one ? If yes, how to do it?

 

Sorry, but I never did that before and I must admit I'm a quite lost! :facepalm:

Can you please write what I'm exactly supposed to write? (for example I don't know if I'm supposed to use a <IfModule mod_alias.c> ...)

 

Thanks so much!

Edited by alainB
Link to comment
Share on other sites

First, "RewriteRule" and "RewriteCond" don't have spaces in them. But the link I posted to StackOverflow just shows using Redirect and RedirectPermanent rules where you just write the old and new URLs, that's all you have to do. Look at the answers from duckyflip and Jon.

Link to comment
Share on other sites

Well, I couldn't do it properly. I would appreciate some more help please.

 

  1. If I understood well, i have to write: RedirectPermanent /domaine-du-mas-sangha.html /location-vacances-argeles-sur-mer-piscine-jardin.html
  2. WHERE do I write it?

I have 2 .htaccess files, one of them in my CMS folder (wordpress). The page I want to redirect is on my CMS.

 

This is my first .htaccess :

 

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
AddType video/mp4 .mp4
ErrorDocument 404 /index.php
# Disable server signature ServerSignature Off
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
And this is my second .htaccess (the one in CMS)

# BEGIN WorldPress

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /blog/

RewriteRule ^index\.php$ - [L]

Rewrite Cond %{REQUEST_FILENAME} !-f

Rewrite Cond %{REQUEST_FILENAME} !-d

Rewrite Rule . /blog/index.php [L]

</IfModule>​

# END WorldPress

 

and now.....I'm LOST!! lol :umnik2:

In wich .htaccess am i supposed to write my line? the 1st one? the cms one? both??

where I write it IN the .htaccess? 1st line? Under a specific line? Am I supposed to replace Something? or delete Something??

 

Thanks for your help guys!!

Link to comment
Share on other sites

The URLs that you write in the rule need to include the entire URL other than the domain. That means that you need the /blog/property folders also, and it looks like your URLs don't end with .html.

 

Also, .htaccess files are processed from each directory in the URL path. I believe that later files will overwrite earlier ones. So a .htaccess file in the domain root will be processed, and also if there's one in the /blog directory, and also if there's one in the /blog/property directory. It checks every directory for the path that was requested.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...