I have searched on the internet and on your forum but just cannot find the code to write a chain redirect.
I understand that it is not good practice to redirect more than 3 times but I need to redirect two pages in my website both which have already been redirected once before.
My website is in HTML and I did the previous redirects on the .htaccess file.
I would like to redirect a second time but cannot find how to write this, would it be:
RedirectPermanent /old-page.html http://www.website/folder/new-page.html http://www.website/folder/new-page-two.html
OR
RedirectPermanent /old-page.html http://www.website/folder/new-page.html /folder/new-page-two.html
or do I redirect directly from the original redirected page?
The first redirect was done about three years ago.
I also need to tell Google that some of my webpages do not exist anymore. Can I put a 410 coding on the same .htaccess page or do I need a separate one or do I just delete them and tell Google through my Sitemap.xml?
I would be so grateful for your help with these confusing questions.
Thanks
I understand that it is not good practice to redirect more than 3
times but I need to redirect two pages in my website both which have
already been redirected once before.
It’s not a “bad practice” issue as you are describing. If a user visits /old-page.html how exactly are they going to go to two URLs from that? Is there any site on the Internet you have ever seen that?
I am assuming you want to have two different redirects. Which you can do like this:
RedirectPermanent /old-page.html http://www.website/folder/new-page.html
And then on www.website you do this:
RedirectPermanent /folder/new-page.html /folder/new-page-two.html
I also need to tell Google that some of my webpages do not exist
anymore.
So if you have a page that doesn’t exist, it should return a 404 & Google will know that. So what is the issue? Unless you want to force requests to 404. Then you would do something like this for a page like bad-page.html to 404 on each request:
RewriteEngine on
RewriteRule ^/?bad-page\.html$ - [R=404]
But it seems like you have very simple issues that you are overcomplicating.
Related
When I first started my website, I had a home/landing page and I installed my blog at myurl.com/blog. I no longer need that homepage and am wondering if there is a way to set myurl.com/blog as my homepage? So if someone types in myurl.com, it will automatically go to myurl.com/blog.
I'd like to avoid any "click here to be redirected" or "you'll be redirected in 10 seconds" type of thing.
There are likely multiple approaches, depending on your setup, but IF your setup qualifies (linux hosting etc) then a simple .htaccess permanent redirect would be the simplest approach:
# Permanent URL redirect
Redirect 301 /blog myurl.com
Our site used to have a blog at oursite.com/blog
Years later, we're still getting many 404s for pages in the /blog/ folder.
How can I use htaccess to redirect the blog folder and all its contents to the front page of our site, oursite.com ?
I have tried a lot of things based on web research but the closet thing I found redirected things like:
oursite.com/blog/?p=3226
to oursite.com/?p=3226
I don't want it to work that way. All blog files no longer exist, so I just want to redirect ALL files from the blog just to the main front page, i.e. oursite.com so:
oursite.com/blog/?p=3226
or
oursite.com/blog/cool-permalink/
or
oursite.com/blog/image.jpg
or
oursite.com/blog/
would ALL simply point to oursite.com
Can you please tell me how to do this? I've spent many hours Googling it unsuccessfully...
Thanks a bunch in advance!
Michael
Create a .htaccess inside the /blog directory.
Add this line to .htaccess
ErrorDocument 404 http://oursite.com
That will take care of any URL that is requested in /blog/
If you want everyone to be redirected if the file doesn't on the whole domain no matter what directory they're in just put the .htaccess in your main directory.
If you are using Apache as your front-end, mod_rewrite is what you want to use. Something like
RewriteEngine On
RewriteRule ^/blog/.* /cool-permalink/ [R]
I am developing a website and I want to integrate it with Facebook, allowing users to share the pages of my website in their FB walls. My problem is explained in the following lines and my question is at the end.
I am using the following URL rewriting rule in my .htaccess file:
RewriteRule ^([a-zA-Z0-9_-]+)\/?([a-zA-Z0-9_-]+)\/?$ index.php?p1=$1&p2=$2
That means it will rewrite anything like: http://address/parameter1/parameter2 as http://address/index.php?p1=parameter1&p2=parameter2.
When I post http://address/parameter1/parameter2 on FB, it will only show the rewritten URL under that URL.
I posted http://address/index.php?p1=parameter1&p2=parameter2 on FB, and it will show the information I want it to show, the ones I have put in the meta tags.
I tried debugging http://address/parameter1/parameter2 on the FB debugger (http://developers.facebook.com/tools/debug), I will get the error:
"The page at ... could not be reached because the server returned status code 400."
Is there any way I can correct that? That is, actually making the dynamic link behave like a static link, and making that transparent to anyone who links it?
Edit:
This change in the rewrite rule should solve the problem:
RewriteRule ^([a-z0-9_-]+)/?([a-z0-9_-]+)/?$ index.php?p1$1&p2=$2 [L,NC]
I also changed the redirects in PHP that I was doing.
And that solved my problem.
I have similar issue to yours, except I manage url rewriting with php dynamically.
I am currently a web host that do not allow url rewriting through htaccess (free.fr)
dynamic standard url is handled properly. But not rewrited url.
How would you get rid of this, considering header status code?
What I could do is doing a redirect instead of include script which produce html output code.
Just have to tell the handler to switch between include and redirect, thanks to a special added param in the url.
But it's not a pretty solution.
I've got half a dozen legacy dynamic URLs and it turns out redirecting them all will require 18 Rewrite directives in my .htaccess file - that seems messy to me.
What I can do however, is redirect all of them to my new start page with a single Redirect directive. It's a tiny site and all the pages people might come in from via google searches are really easily findable from the start page so I'd like to do that however...
I'm worried this might kill the site's modest (but worth maintaining) page rank as several URLs would then be resolving to the same URL and content.
Does anyone know if this would be the case, and if so, if there are strategies to avoid that other then not implementing the above?
Thanks!
Roger.
As long as you do 301 Redirects (permanently moved) vs 302 Redirects (temporarily moved), then all the accumulated page rank from your dozen legacy URLs will transfer to the new url you are redirecting to.
So you will not "lose" the pagerank, it will simply be transfered over to the new URL.
The important thing is to ensure it's a 301 Redirect.
We are migrating to a Sharepoint solution and our urls are changing slightly.
Are most RSS readers able to follow redirect links without breaking the feed and making an update manually?
Most of the documentation I'm reading says that this will work for major RSS readers.
I have read in some places that a lot of RSS readers will treat a 301 as a temporary redirect and not update its stored url. Any truth to this?
Assuming you are using a 301 redirect, I would say yes, since any reader worth its salt is built on a compliant HTTP library which will honor the 301 status code and follow the redirect.
Of course, it's not that hard to test with the reader of your choice.
Pretty much every RSS reader - major or minor - will update the feed URL when it encounters a 301 redirect.
In my (limited) experience, most applications will ignore the "permanent" part of a permanent redirect and execute the same logic they would use for a temporary redirect.
It may be necessary to make its site velindekserede about. What to do so to preserve PageRank, link popularity and traffic?
As I understand it, so the solution is called a 301 redirect. It tells search engines that the URL has been permanently moved. How a redirect should be done in a special way. At this link there are different options depending on what kind of server technology you use:
http://www.webconfs.com/how-to-redirect-a-webpage.php
I just tried it in practice. I use PHP itself on all my sites, so I used the PHP instructions:
I ripped all my old page for tags and content and put the small code snippet on the page. Prisoners of the new URL for the page, and saved it. Tested the page by typing the old URL and then redirects worked. To be absolutely sure that redirects are search engine friendly, I used this "Search Engine Friendly Redirect Checker":
http://www.webconfs.com/redirect-check.php
There no disagreement about how well the 301-redirect is working and whether it can transfer an entire site to a new domain (http://www.webmasterworld.com/link_deve ... 135964.htm), but people's experience says that it is good enough. You just make sure that the new URL has the content as the old page had