If I want to 301 redirect (SEO required) from old static pages to new static pages, what should I do?
I search in Google and find that it seems cannot be set inside the static page (meta tag) for 301 redirect.
My server is Netscape Enterprise.
Thanks.
This is a list of how to do it in several different environments, how-to-redirect-a-webpage. Unfortunately not Netscape Enterprise, but maybe it could give you a clue. It does go through how to redirect a html file.
This link may help as well, Search Engines and 301 Permanent Redirects it mentions Netscape Enterprise Server, but only in saying that its not possible to do a 301 redirect.
You're correct in that you can't have a static page respond with a 301 permanent redirection.
You need to use some serverside technology to set the response headers, e.g. JSP:
<%
response.setStatus(301);
response.setHeader( "Location", "http://www.newpage.com" );
response.setHeader( "Connection", "close" );
%>
I'm not sure about Netscape Enterprise, but on most web-servers (at least in IIS) you can set up redirects (both 301 and 302) for static files within the web-server admin area, i.e. not within the file itself. I imagine Netscape Enterprise would offer a similar function.
Related
I have a webpage whose information had to be split into two separate pages. I want visitors to inform of the fact that there are now two different pages, and thus serve visitors of the old single-page page a custom error page like
(Depending on who you are, ) the page you want is either of these:
*Link to page A*
*Link to page B*
This should be in HTML (to obey the general web site style).
The things that I'm unclear about are semantics and apache configuration
What HTTP Status Code to serve? There is 301 Moved Permanently, but I have more than one alternative to offer.
Is it possible to configure apache to my needs without a hacky LocationMatch or similar? Ideally, I would like to use the normal file serving semantics with the exception that the HTTP Status code should not be 200.
Thanks for the clarifying comment.
In answer to your two questions, I'd say:
Yes, 301 is the correct response to give. This will say that the old page was moved permanently, and will redirect the user to the interstitial page with the links.
You can accomplish this by adding a line to the .htaccess file in the directory that the old single page was once in (assuming you keep the new page there too). Or you can add a line to your main httpd.conf file. The lines would look like this:
.htaccess
Redirect 301 ./old_page.html ./new_interstitial_page.html
httpd.conf
Redirect 301 /path/to/old_page.html /path/to/new_interstitial_page.html
EDIT : Without any more context, this really does sound like a redirect scenario. In HTTP terms, the "resource" that was once available at the old location is now available (albeit in parts) at a new location, so you would "redirect" the client to the new location or to the interstitial page.
But if that doesn't seem right to you, you can try a "410 Gone". This says that the resource no longer exists at all, and instead directs the client to an error page. You can then customize the error page to contain links to Page A and Page B. Your .htaccess would look something like this:
# Enable URL matching and match the old page with "Gone" (G), "Last rule" (L)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^oldPage.html$ - [G,L]
</IfModule>
# Special 410 page with links to Page A and Page B
ErrorDocument 410 /path/to/custom/410-page.html
I have WordPress installed in the root of a website, and recently enabled a custom permalink structure just for the sake of having good looking page URLs (only pages are used in this website, no posts at all — it's not a blog). Unfortunately this is causing some problems with other parts of the website, outside WordPress.
So I'd like to go the manual way: and redirect URLs like /my-page to /?page_id=32 just for a selected amount of pages. Is it possible to do that using the .htaccess file? What would the rules look like?
If you're redirecting pages from Wordpress to other URLs, you can use .htaccess. But it's probably easier to use a plugin to redirect rather than edit .htaccess.
See WordPress › Redirection « WordPress Plugins to easily set up redirects and log redirects, errors, and more.
As time goes on we are sometimes required to change a page that is ranked well to a new page name. For instance, GreatInfo.asp to be replaced by the same content but called GreatInfo.php
It's basically a 301 redirect but on the page level. I'm running Windows Server (IIS7) and can do full site 301 redirects but not clear on the same goal for a single page.
I researched this page but still it is not clear:
http://www.seomoz.org/learn-seo/redirection
This page concludes in saying to simply paste code on your page to achieve the individual page 301 redirect:
http://www.bruceclay.com/blog/2007/03/how-to-properly-implement-a-301-redirect/
but yet no reference is given to such code..
So I would have to say my question is what code is used at a page level to do a single page 301 redirect?
I believe I found the answer:
301 redirects in PHP
In some cases, you can’t do it with .htaccess so you’re stuck doing it at the page level. If you need to do a 301 redirect in PHP, here’s how:
<?php
header(“HTTP/1.1 301 Moved Permanently”);
header(“Location: http://www.example.com/”);
?>
Note: you’ll need to make sure you don’t echo out any HTML or text before executing these functions.
301 redirects in ASP
If you’re using ASP, it looks like this:
<%
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", "http://www.example.com/"
Response.End
%>
Now whether this retains any positive SEO ranking from the page setting the 301 redirect, I do not know... Also I've not found the same page level methods for a static html page redirect. But at least for classic asp and php the methods above will work well.
i am getting canonical issue in my web site. the error is as follows:
The page with URL "http://dynamicsexchange.com/images/CRMcommunity_supersources_withspaces.jpg" can also be accessed by using URL "http://www.dynamicsexchange.com/images/CRMcommunity_supersources_withspaces.jpg".
all errors i got are related to non-www and www so, please tell me how to set www.mysite.com for my site.
Thanks and Regards
M Prasad Reddy
If it's asp 2 and above you can implement it in 2 ways:
1) ASP.NET: Redirecting with ASP.NET and IIS
you can implement 301 redirects using ISAPI Rewriting modules, products like UrlRewriter.NET which is discussed in Chapter 3, "Provocative SE-Friendly URLs," of the book, Professional Search Engine Optimization with ASP.NET: A Developer's Guide to SEO, or from within your ASP.NET code by setting the appropriate header data.
When using ISAPI_Rewrite, redirecting is implemented similarly to URL rewriting, except that you specify a redirection status code as a parameter.
Example :
The following rule does a 301 redirect to Catalog.aspx when the initial request is for Catalog.html:
301 Redirect Catalog.html to
Catalog.aspx RewriteRule
^/Catalog.html$
http://seoasp/Catalog.aspx [RP]
2) In Code
If you want to implement the redirect yourself, you need to manipulate the response headers using the Response object provided by your current HttpContext object. Here's how to 301 redirect Catalog.html to Catalog.aspx yourself:
if (context.Request.Path == "/Catalog.html")
{
context.Response.Status = "301 Moved Permanently";
context.Response.AddHeader("Location", "http://www.example.com/Catalog.aspx");
}
Explanation: The first URL should be a relative path to the old URL and the second one should be an absolute path to the new URL.
I'm sure i've seen a feature in apache that can rewrite urls so you can point domain2.com at domain1.com and it rewrites everything domain1.com to domain2.com on the fly.
is there a similar thing for https?
In apache, if i go to https://example.com, the page itself is over https, but all images/links are http://. Is there way to auto rewrite the html so its all https://?
(it's running zen cart by the way)
Try this:
Using a protocol-independent absolute
path:
<img src="//domain.com/img/logo.png"/>
If the browser is viewing an page in
SSL through HTTPS, then it'll request
that asset with the https protocol,
otherwise it'll request it with HTTP.
This prevents that awful "This Page
Contains Both Secure and Non-Secure
Items" error message in IE, keeping
all your asset requests within the
same protocol.
Unless you use absolute URLs everyhwere, this should work "automagically". So you only need to check two things:
use relative URLs to point to resources on your own server and
make sure you're not using <base href="http://something">
You can just link to /path/to/page.html instead of http://example.com/path/to/page.html. That way, if it's HTTP it'll stay HTTP, and if it's HTTPS it'll stay HTTPS.
If Zen Cart is adding the domain to all links, though, you'll need to edit the software.
The apache module you referenced is called mod_rewrite, and yes it can handle what you are asking for, although I agree with the above answers that using a protocol independent path is the best solution.