Best solution to redirect a site internally - html

I have a site hosted on a commercial provider and all site were developed on /portal folder.
Until today I redirect the site using frameset:
<html>
<head>
<title>Titulo</title>
<meta name="google-site-verification" content="xxx" />
<meta http-equiv="Content-Language" content="pt-br">
<meta name="description" content="xxxx">
</head>
<FRAMESET>
<FRAME SRC="http://www.test.com.br/portal" NORESIZE>
<body></body>
</FRAMESET>
</html>
Now, the host provider suggests me to use:
<script>window.location='http://www.test.com.br/portal';</script>
Is this faster or better than the frameset approach ?
Is Google or other search engine will continue to search for the content?

You have different ways to redirect to another page. If you're using a server-side language like php you can use this (before the headers has been sent):
header("Location: http://www.test.com.br/portal");
using HTML you can do this:
<meta http-equiv="refresh" content="0;url=http://www.test.com.br/portal">
Using Javascript you can do this:
<script>window.location='http://www.test.com.br/portal';</script>
The best way, in my opinion, is the first because of you can also specify the type of redirect (permanent or temporary) and this is better from a SEO point of view. Google and the other search engines will be able to crawl your page easily if you choose the first solution.

Just add this tag to the head section
<meta http-equiv="refresh" content="0; URL=http://www.test.com.br/portal"/>

For some reasons it's better than using framesets.
In addition to
<script>window.location='http://www.test.com.br/portal';</script>
you can put a link to that page into your HTML body, something like this:
<p>You will now be redirected to another page.<br/>
If it didn't happen, use this link:
http://www.test.com.br/portal</p>
But the solution with php's header function (Aurelio De Rosa's answer) is better indeed.

Related

How to 301 redirect a static url to another static url?

My website is HTML/CSS/JS website with no server (static website) sitting on MS Azure.
I have recently changed 2 of the html files like this:
www.mydomain.com/oldfile1.html
www.mydomain.com/oldfile2.html
To
www.mydomain.com/newfile1.html
www.mydomain.com/newfile2.html
how can I redirect the old url for the sake of SEO, considering the webiste is static and .htaccess doesn't work and it seems the using meta tag in html file is not considered as 301 permanent redirection?!
A 301 Redirect is a server side directive.
Anything you place in a client side file (<meta> / javascript) cannot be read by the browser until the files arrive in the browser.
At this point it's too late to execute a server side directive.
You're now pointing the browser at the destination you're trying to point it away from.
Probably not the best answer, but you could change the the html of oldfiles to redirect to the newfiles.
So something like this:
<html>
<head>
<!--Tells search engines to not index this page-->
<meta name="robots" content="noindex">
<!--Redirect to new resource-->
<meta http-equiv="Refresh" content="0; url=www.mydomain.com/newfile1.html">
</head>
<body>
<!--In case both JavaScript and the meta tag fail-->
<p>If you aren't automatically redirected please followthis link.</p>
<script>
//JavaScript fallback if browser does not support/allow http-equiv="Refresh"
window.location = 'www.mydomain.com/newfile1.html'
</script>
</body>
</html>

Facebook Open Graph tags not being grabbed (Grav CMS)

Facebook is not picking up open graph meta tags and the debugger responds as if they're not in the source code at all.
Here's the relevant page source (with title and url anonymized)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Page Title</title>
<meta property="og:title" content="Page Title" />
<meta property="og:url" content="http://page.url/page-name" />
<meta property="og:type" content="article" />
I found the problem. For posterity: Grav CMS sends a Content-Encoding: none header when GZIP is not enabled. Facebook doesn't like this header, it breaks it's libcurl. In the sharing debugger it doesn't report this, it instead says the tags are missing.
The simplest solution of course is to turn on GZIP in Grav config.
Side note: I thought Grav was going to be a quick solution for a family member, the simple interface coupled with it supposedly being developer friendly under the hood appealed to me. Turns out it's developer friendly in the sense that you will encounter problems that will require your developer experience to solve as a result of there being numerous documentation errors, missing basic features and bugs in the plugins required for basic functionality. Also note that Google is not your friend for solving Grav problems as there's surprisingly little community support compared to other popular CMS.
Not saying this to trash Grav, there's a lot about it that's good, the above is just stuff I wish I'd known going in.
The Social Meta Link plugin readme now explains the gzip issue, but for me I additionally had to patch the plugin source code by hand on the server to strip the internal port number from the og:url meta links because I run a reverse proxy setup.

Multiple Redirects on one HTML

I would like to create a page which redirects to several pages when it is pressed.
I have written the following code in order to try and do it:
<html>
<head>
<meta http-equiv="refresh" content="0; url=http://www.example.com/a" />
<meta http-equiv="refresh" content="0; url=http://www.example.com/b" />
<meta http-equiv="refresh" content="0; url=http://www.example.com/c" />
</head>
</html>
On the web server log, I see that a request was only sent to "c".
Why is that?
And how can I create an HTML page with multiple redirects?
You will inevitably need to use javascript.
<script>
function redirect(){
windows.open("http://www.example.com/a")
windwos.open("http://www.example.com/b")
windwos.open("http://www.example.com/c")
}
</script>
<body onload="redirect()">
Didn't test but should suffice
I am not sure you understand, when refresh means. Refreshing with 0 means the browser is immediately redirected to the address provided. As far as one browser tab can only show one web page, your example cannot work.
You need to consider using Popups or alike to show the user several pages at one time.

Redirect HTML-page using meta refresh over symbolic link

I have a simple place-holder html-file that I would want to use the header meta tag to redirect automatically. The target is a symolic link (linux) that points to a git-repo directory.
<meta http-equiv="refresh" content="0; url="universitetet/">
However this simply reloads itself. Giving absolute path does so too.
However, using the javascript solution works (and also normal links work fine).
<script language="javascript">
window.location = "universitetet/";
</script>
Get rid of the extra " inside the content attribute.
<meta http-equiv="refresh" content="0; url=universitetet/" />
Side note: Always provide a plain HTML link (Link), in case the user has disabled meta redirection and/or JavaScript.
This code:
<meta content="0; url=(YOUR_LINK)" http-equiv="REFRESH">
Working with me, btw your code have issue with quotations: here content="0; url="universitetet/".

What meta tags to include on a modern website?

Currently all I have on each page is <meta http-equiv="content-type" content="text/html; charset=UTF-8" />. Do people still include meta tags like keywords, description, and author? If so, should they go on every HTML page or just the home-page?
Well you defiantly should have the meta charset
<meta charset="utf-8">
The http-equiv is not needed because it represents the HTTP header equivalent. For the web however the Content-Type HTTP header supplied via the web server (probably apache) should do. You can override the server defaults via .htaccess or using the PHP header() function.
It is also not a bad idea to include
<meta name="description" content="">
<meta name="author" content="">
Paul Irish's html5 boiler plate also recommends using:
<!-- Always force latest IE rendering engine (even in intranet) this if you use the .htaccess -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
http://html5boilerplate.com/docs/#The-markup★make-sure-the-latest-version-of-ie-is-used
<!-- Mobile viewport optimized: j.mp/bplateviewport -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
http://html5boilerplate.com/docs/#The-markup★mobile-viewport--creating-a-mobile-version
I don't think keywords have any impact on the ability to find your site using search any more. If you're going to use a description, you might want to include it on every page as it will help search engines to display a more usable description than they otherwise might for that page. I don't think it would be worth developing a separate description for each page, use use the same one on all. It wouldn't hurt to omit all of them, see http://en.wikipedia.org/wiki/Meta_element
Meta tags like Keyword , Description author used from a long time to tell search engine about the content current page.
Like a product website the description should be information about product and Keyword about the tags product have and Author is a book writer. it's help search engine like google to tell them what is content on the page.
their is no need of it but it's help to improve the SEO.