I use TYPO3 6.2.
I'm working on a very special page which is not ready for public but I discovered that Google already found it and indexed it. This a a real problem because the page has to be available only for the 2018 summer.
If I disable the page in the back-end then I can still work on it and the page is no longer available for other people, but the URL generates a 404 Not Found.
-> How to generate a 301 redirect to the homepage instead ?
localconf.php or installtool settings:
#have to be 1
$TYPO3_CONF_VARS['SYS']['curlUse'] = 1;
#have to be empty
$TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT']['init']['postVarSet_failureMode'] = '';
#logical part
$TYPO3_CONF_VARS['FE']['pageNotFound_handling'] = '/404.html';
$TYPO3_CONF_VARS['FE']['pageNotFound_handling_statheader'] = 'HTTP/1.1 301 Moved Permanently';
$TYPO3_CONF_VARS['FE']['pageNotFound_handling'] = 'USER_FUNCTION:fileadmin/scripts/pagenotfound.php:user_pagenotfound->pagenotfound';
content of user function (fileadmin/scripts/pagenotfound.php)
<?php
define('REDIRECTPAGE', '/');
class user_pagenotfound {
function pagenotfound($param, $conf) {
$server_name = $_SERVER;
header("HTTP/1.0 301 Moved Permanently");
print '<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>301 Moved Permanently</title>
<SCRIPT LANGUAGE="JavaScript">
<!--
function doRedirect() {
window.location="http://'.$server_name.REDIRECTPAGE.'";
}
doRedirect();
// -->
</script>
</head>
<body style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;text-align:center;";>
<div style="font-size:20px;text-align:center">The page you have requested cannot be found</div>
<div>If you are not automaticly redirected in 3 seconds please click here: <br />
<br /><a href='.$server_name.'>'.$server_name.'</a></div>
</body>
</html>';
exit;
}
}
?>
Source from here: http://www.typo3forum.net/discussion/34942/301-moved-permanently-statt-404-page-not-found by smartlife
And: http://blog.marit.ag/2009/03/20/korrektes-404-error-handling-mit-typo3/
Related
I have created a simple login page in which user will give an username and password , and then it will be stored in session. After clicking on submit button it will show welcome user or the name. And if the user waits for few seconds then the session will expire and it automatically return back to the login page.
Here is my login page
<%# page import="java.io.*,java.util.*" language="java" contentType="text/html;
charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="user" class="user.LoginUser" scope="session"></jsp:useBean>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>login</title>
</head>
<body>
<h1><center>Give your login details</center></h1>
<form method="post" action="check.jsp">
Username:<input type="text" name="username" size="20" value="<%=user.getUser() %>" > <br>
Password:<input type="password" name="password" size="20" value=<%=user.getPassword() %> ><br>
<input type="submit">
</form>
</body>
</html>
now in check.jsp i am doing my checking part for username and password
<%# page import="java.io.*,java.util.*" language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="user" class="user.LoginUser" scope="session"></jsp:useBean>
<jsp:setProperty name="user" property="*"/>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>login checking</title>
</head>
<body>
<%
String USER=user.getUsername();
int PASSWORD=user.getPassword();
if(USER.equals("abhirup"))
{
if(PASSWORD==54321)
{
pageContext.forward("display.jsp");
}
else
{
out.println("Wrong password");
pageContext.include("login.jsp");
}
pageContext.include("login.jsp");
}
%>
</body>
</html>
and then finally i am displaying it in display.jsp
<%# page import="java.io.*,java.util.*" page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="user" class="user.LoginUser" scope="session" ></jsp:useBean>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Display</title>
</head>
<body>
<% String title="Welcome : successful login";
out.println(title);%>
<h3><center>Your Name:Abhirup Parui</center></h3><br>
Username<%=user.getUsername()%><br>
<%session.setMaxInactiveInterval(20);
pageContext.include("login.jsp");
%>
</body>
</html>
and also this is my LoginUser.java file
package user;
public class LoginUser {
String username;
int password;
public void setUsername(String value)
{
username=value;
}
public void setPassword(int value)
{
password=value;
}
public String getUsername(){return username;}
public int getPassword(){return password;}
}
I am using Eclipse IDE and Tomcat server. Eclipse has shown not a single error in any of the pages but still when i run my login.jsp page.
I am getting this error on running login.jsp
i have followed this link
please help me to find my errors.
Update
I can successfully run my login page.
I am getting this error now, but could not figure out where is the error.
last part of the error is this
how to fix these error . help
Because you're trying to access login.jsp directly from the browser you have to move it out of the WEB-INF directory - files in WEB-INF are not publicly accessible. If you move login.jsp up one directory and enter http://localhost:8088/abhirup/login.jsp in your browser it should pull up the page. However, it is a fairly common practice to put jsp pages under WEB-INF/jsp or something similar and use a servlet to intercept and process requests and then have the servlet forward to the appropriate jsp page.
You have a syntax error on line 1, column 46 of display.jsp because you have the word page before your language declaration. Change this:
<%# page import="java.io.*,java.util.*" page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
to this:
<%# page import="java.io.*,java.util.*" language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
I also tried the same code and I found some error in two JSP files
My login.jsp corrected code is as given below:
<%# page import="java.io.*,java.util.*" language="java" contentType="text/html;
charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%# page import="user.LoginUser"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="user" class="user.LoginUser" scope="session"></jsp:useBean>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Login page</title>
</head>
<body>
<h1><center>Give your login details</center></h1>
<form method="post" action="check.jsp">
User name:<input type="text" name="username" size="20" value="<%=user.getUsername() %>"><br>
Password:<input type="password" name="password" size="20" value="<%=user.getPassword()%>" ><br>
Submit <input type="submit">
</form>
</body>
</html>
Corrected check.jsp code is as follows:
<%# page import="java.io.*,java.util.*" language="java" contentType="text/html;charset=ISO-8859-1"pageEncoding="ISO-8859-1"%>
<%# page import="user.LoginUser"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="user" class="user.LoginUser" scope="session"></jsp:useBean>
<jsp:setProperty name="user" property="*"/>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Login checking</title>
</head>
<body>
<%
String USER=user.getUsername();
String PASSWORD=user.getPassword();
if(USER.equals("admin"))
{
if(PASSWORD.equals("admin"))
{
pageContext.forward("display.jsp");
}
else
{
out.println("Wrong password");
pageContext.include("login.jsp");
}
pageContext.include("login.jsp");
}
%>
</body>
</html>
Corrected display.jsp code:
<%# page import="java.io.*,java.util.*" language="java" contentType="text/html;charset=ISO-8859-1"pageEncoding="ISO-8859-1"%>
<%# page import="user.LoginUser"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="user" class="user.LoginUser" scope="session" ></jsp:useBean>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Display</title>
</head>
<body>
<% String title="Welcome : Successful Login";
out.println(title);%>
<h3> <center> Your Name : Reneesh </center> </h3><br>
User name : <%=user.getUsername()%><br>
<%session.setMaxInactiveInterval(20);
%>
</body>
</html>
My Java file LoginUser.java corrected code is as follows:
package user;
public class LoginUser {
String username;
String password;
public void setUsername(String value)
{
username=value;
}
public void setPassword(String value)
{
password=value;
}
public String getUsername()
{
return username;
}
public String getPassword()
{
return password;
}
}
Kindly try with this code, I made some changes in the code by assigning String valuue for Password. I also used Eclipse juno IDE and Apache Tom Cat v 7.0 for running this Dynamic web project. Hope you will try and let me know if there is further error.
I want to create a redirect from two different urls redirect to just one URL. I hope this question has a simple answer, I've actually provided the sample code I'm using below & just wanted to know if I could add another URL to the code below maybe using an "else if" statement....Thanks for your help
<%# Language=VBScript %>
<%
servername = Request.ServerVariables("HTTP_HOST")
if trim(Request.ServerVariables("HTTP_HOST")) = "levi.com" or
trim(Request.ServerVariables("HTTP_HOST")) = "levis.com" then
url = "http://www.timoloud.com/"
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", url
Response.End
end if
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script language="Javascript">
function redirect() {
window.location.href = 'http://www.levi.com/timoloud.com';
}
</script>
</head>
<body onload="redirect();">
</body>
</html>
Using Select Case statement may be easier to doing this.
Select Case Request.ServerVariables("HTTP_HOST")
Case "levi.com", "levis.com", "other.com", "another.com"
url = "http://www.timoloud.com/"
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", url
End Select
It's not very clear to me but i suppose you want something like this
<%# Language=VBScript %>
<%
servername = Request.ServerVariables("HTTP_HOST")
redirectedUrls = "/levi.com/levis.com/"
if instr(redirectedUrls,"/" & servername & "/") then
url = "http://www.timoloud.com/"
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", url
Response.End
end if
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script language="Javascript">
function redirect() {
window.location.href = 'http://www.<%=servername%>/timoloud.com';
}
</script>
</head>
<body onload="redirect();">
</body>
</html>
I would like to make a webapp that uses the "UIScrollView" xcode-function but in html.
There's no problem making a html page that puts a bunch of images in one row.. I just want to make a iphone horizontal scroll with swipe gesture to show the next image.
Can this be made?
You'll need to watch for touchstart and touchend (or touchmove) to figure out the direction, then just replace the image with the next/previous. Here are some links:
https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html
http://www.sitepen.com/blog/2008/07/10/touching-and-gesturing-on-the-iphone/
Untested:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
var startX;
var endX;
var pic=0;
var pics = ['pic1.png','pic2.png','pic3.png'];
document.getElementById('picture').setAttribute('src',pics[pic]);
function touchStart(event){
startX = event.touches[0].pageX;
}
function touchEnd(event){
endX = event.touches[0].pageX;
deltaX=endX-startX;
if(deltaX>0){
next();
}
else{
prev();
}
}
function next(){
pic++;
if(pic>pics.length){pic--;}
document.getElementById('picture').setAttribute('src',pics[pic]);
}
function previous(){
pic--;
if(pic<0){pic++;}
document.getElementById('picture').setAttribute('src',pics[pic]);
}
</script>
<style>
#pictureFrame{height:460px; width:320px; top:0; left:0;}
</style>
</head>
<body>
<div id="pictureFrame"><img ontouchstart="touchStart(event);" ontouchend="touchEnd(event);" id="picture"/></div>
</body>
</html>
I don't know what's wrong with my embed script, to my logic it should properly embed the video in the frame, but it loads a framed view of www.youtube.com instead of my video video.
There are 2 files in a single directory:
ClassMedia.php:
<?php
class Media {
public function embedYT($code){
echo "<iframe width='560' height='349' src='http://www.youtube.com/embed/".$code." frameborder='0' allowfullscreen></iframe>";
}}
Demo.php:
<?php include "classMedia.php"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Demo</title>
</head>
<body>
<?php
$media = new Media();
$code = "XSGBVzeBUbk";
$media-> embedYT($code);
?>
</body>
</html>
You're missing a single quote right after src='http://www.youtube.com/embed/".$code.", you want this:
echo "<iframe width='560' height='349' src='http://www.youtube.com/embed/".$code."' frameborder='0' allowfullscreen></iframe>";
Note the added single quote.
YouTube ends up seeing a bad URL (http://www.youtube.com/embed/$code frameborder= where $code is the real code) and hands you the homepage instead of what you think you were asking for.
when i call the getAbsoluteLeft/Top method i always get 0 in firefox. For the IE i get a value which seems to be correct. Are there known problems using these methods ? My problem is that i want to set the position of an element with the absolute position values of another element. Thanks in advance. Edit: Using GWT 2.0.3
kuku
EDIT Testcase:
1. The host page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Web Application Starter Project</title>
<script type="text/javascript" language="javascript" src="samplegwt/samplegwt.nocache.js"></script>
<script type="text/javascript" language="javascript">
function execute() {
var element = document.getElementById("paragraph");
if (element != undefined)
element.style.display = "block";
}
</script>
<STYLE TYPE="text/css">
#paragraph {
display: none;
}
</STYLE>
</head>
<body class="body" onload="execute()">
<div align="center">
<table>
<tr>
<td>
<p id="paragraph">
<input type="text" id="example" value="Foobar" > <img border="0" src="images/some.gif" alt="Test"></p>
</td>
</tr>
</table>
</div>
</body>
</html>
In the onModuleLoad() i simply do this: System.out.println(Document.get().getElementById("paragraph")
.getAbsoluteLeft());
Well as stated in the comments the problem was that the element is not visible which results into 2 different behavoirs for IE and FF.