alainB Posted April 1, 2016 Share Posted April 1, 2016 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! 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!! Link to comment Share on other sites More sharing options...
justsomeguy Posted April 1, 2016 Share Posted April 1, 2016 The most common way would be to use the server's .htaccess file to redirect requests for those URLs to the new ones. Link to comment Share on other sites More sharing options...
alainB Posted April 2, 2016 Author Share Posted April 2, 2016 ok, and what should I write? I sthat something like : bla bla bla "old url" bla bla bla "new url" ? Somebody can show me the text/code I must use please? Thanks!!! Link to comment Share on other sites More sharing options...
justsomeguy Posted April 4, 2016 Share Posted April 4, 2016 There are a few options listed here: http://stackoverflow.com/questions/1421068/htaccess-301-redirect-of-single-page Link to comment Share on other sites More sharing options...
alainB Posted April 13, 2016 Author Share Posted April 13, 2016 (edited) 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! 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 April 13, 2016 by alainB Link to comment Share on other sites More sharing options...
justsomeguy Posted April 13, 2016 Share Posted April 13, 2016 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 More sharing options...
alainB Posted April 13, 2016 Author Share Posted April 13, 2016 ok thanks! Link to comment Share on other sites More sharing options...
alainB Posted April 14, 2016 Author Share Posted April 14, 2016 Well, I couldn't do it properly. I would appreciate some more help please. If I understood well, i have to write: RedirectPermanent /domaine-du-mas-sangha.html /location-vacances-argeles-sur-mer-piscine-jardin.html 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 .mp4ErrorDocument 404 /index.php # Disable server signature ServerSignature Off # BEGIN WordPress<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /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 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 More sharing options...
dsonesuk Posted April 14, 2016 Share Posted April 14, 2016 How about you try it in one or the other and see what happens. Link to comment Share on other sites More sharing options...
justsomeguy Posted April 14, 2016 Share Posted April 14, 2016 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 More sharing options...
alainB Posted April 15, 2016 Author Share Posted April 15, 2016 @dsonesuk : I did, but, as I said, I'm not sure about my code, and about the place to write it - in any htaccess -. I did like 20 tries, using different "ways", but I was unsuccessfull... It's why I asked for help with more détails... Link to comment Share on other sites More sharing options...
alainB Posted April 15, 2016 Author Share Posted April 15, 2016 @justsomeguy : Thanks for the details, it works perfectly now!! You saved me, I was almost going to throw my computer threw the window!! lol. Thanks again. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now