我有一个静态HTML网页,我想将其状态代码设置为404"未找到".
但是,我想使用javascript或jQuery,而不是任何服务器端语言.
我怎么能在客户端上这样做?用javascript或者<meta>标签?
现在已经向所有开发人员开放了Google Cloud Endpoints,我创建了一个Google Cloud Endpoint,可以在Eclipse调试中运行本地运行.但是当我部署时,实时端点只返回HTTP 404.我的项目的JSP页面在本地运行并部署.它只是部署后不起作用的端点.
任何人都知道我需要做什么来部署云端点?
google-app-engine http-status-code-404 google-cloud-endpoints
Windows 7
Python 2.7.3
Django 1.5
python manage.py runserver
我正在关注" https://docs.djangoproject.com/en/1.5/intro/tutorial03/ "上提供的教程.
在事情变得奇怪之前,我得到了"写一个404(页面未找到)视图".
我试图找出如何制作自定义404视图.但是,我不确定:
答:自定义404.html文件应该驻留在哪里.它应该在我的项目目录树中还是在我的Django目录树中.我的项目目录树看起来像这样,
1> mysite
2> - mysite
3> - polls
4> - templates
5> - polls
6> - templates
7> - admin
Run Code Online (Sandbox Code Playgroud)
目前404.html是@ 6>
B.必须在哪些地方进行哪些修改?我知道需要在'root'url conf中设置handler404和handler500.我有一个url.py驻留在@ 2>和3>(参见上面的树).假设2>是正确的位置我假设语法如下,
handler404 = 'templates.404'
handler500 = 'templates.500'
Run Code Online (Sandbox Code Playgroud)
还需要设置什么,在哪里?
我将Magento站点从一个服务器移动到另一个服务器(域名没有更改),并且在新服务器上主页显示正常,但是当我点击链接时,它在每个链接上给出了404错误.我也尝试访问管理面板,我收到同样的问题.我已经尝试从URL中删除"index.php"以查看这是否有所不同,但错误仍然存在.
我删除了缓存文件夹和会话文件夹中的文件.我已经更新了local.xml文件以使用新的数据库详细信息,这似乎很好,因为Magento正在显示数据库中的数据.
我的.htaccess文件是标准文件,但在这里供您参考.
############################################
## uncomment these lines for CGI mode
## make sure to specify the correct cgi php binary file name
## it might be /cgi-bin/php-cgi
# Action php5-cgi /cgi-bin/php5-cgi
# AddHandler php5-cgi .php
############################################
## GoDaddy specific options
# Options -MultiViews
## you might also need to add this line to php.ini
## cgi.fix_pathinfo = 1
## if it still doesn't work, rename php.ini to php5.ini
############################################
## this line is specific for 1and1 hosting
#AddType x-mapp-php5 …Run Code Online (Sandbox Code Playgroud) 您好我如何使用.htaccess将错误404重定向到主页?
示例: site.com如果写入site.com/some_site_notforund而不是404将我们重定向到主页面
示例2:
sadistic.pl如果写sadistic.pl/some_site_notfound而不是404将我们重定向到当前页面
我想使用SpringBoot返回自定义404错误,但我希望能够为它添加一些服务器端逻辑,而不仅仅是提供静态页面.
1.我关闭了默认的白标签页面 application.properties
error.whitelabel.enabled=false
我在下面添加了一个Thymeleaf error.html resources/templates
这顺便说一下.页面已提供,但未调用任何控制器.
我创建了一个类Error作为"控制器"
package com.noxgroup.nitro.pages;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/error")
public class Error {
@ExceptionHandler
public String index() {
System.out.println("Returning Error");
return "index";
}
}
Run Code Online (Sandbox Code Playgroud)
不幸的是,我没有看到Returning Error在控制台的任何地方打印.
我正在使用嵌入式Tomcat和Spring Boot.我已经看过各种各样的选项,其中包括使用@ControllerAdvice,删除RequestMapping等等,其中没有任何选项.两者都不适用于我.
我的问题实际上接近这个问题:根据文化,Umbraco V6 404没有得到妥善处理
我有2个不同文化的目录:
Content
EN
page1
page2
404
FR
page1
404
Run Code Online (Sandbox Code Playgroud)
当我从FR页面转到404页面时,文化又回归英语.
看起来它是基于网址的,并且可能使用404引擎无法找到链接,因此它将文化设置为默认,但我希望在用户遇到404页面时保持这种文化.
我的配置:
<error404>
<errorPage culture="en-US">1187</errorPage>
<errorPage culture="fr-FR">1189</errorPage>
</error404>
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点 ?
我在域中使用一级路径.
网址示例:
我使用umbraco 7.2.5
我正在使用Angular JS ui-router构建一个简单的HTML站点.
我已经构建了一个自定义404页面('www.mysite /#/ error/404'),如果用户键入了像'www.mysite /#/ invalidUrl'这样的URL,用户将被重定向到该页面.此功能通过以下代码段实现:
$urlRouterProvider
.when('', '/')
.when('/home', '/')
.otherwise('/error/404');
Run Code Online (Sandbox Code Playgroud)
以下状态片段:
$stateProvider.state('404', {
parent: 'app',
url: '^/error/404',
views: {
'errorContent@main': {
controller: 'error404Controller',
templateUrl: 'js/general/templates/error404.html'
}
}
});
Run Code Online (Sandbox Code Playgroud)
我正在尝试捕获用户请求的无效URL,以便向用户显示,如下所示.
无法找到您请求的网址我试过听'$ stateNotFound'事件,这似乎只是在请求特定的无效状态时触发.我也试图听'$ stateChangeStart','$ locationChangeStart'和'$ locationChangeSuccess'事件,但找不到实现此功能的方法.
这可能吗?请分享您的想法 - 谢谢
这让我疯狂了几个星期:如何在404页面上提供会话?我只是将404错误页面嵌入到我的默认模板中.它还显示了导航栏和页脚,但是如何在404上保持用户登录?
在404 Auth :: check()上总是返回false,其他特定于会话的其他内容为null或为空.
如何在(404)错误页面上启用会话?
我正在尝试在我正在开发的新页面中实现Azure Active Directory B2C,但是我404 - File or directory not found尝试从我的页面登录时遇到此错误.
我做了房客,注册了我的应用程序,创建了我的政策,整个交易.我可以从Azure门户测试它们没有太多问题.但是,我按照官方教程中的指示来实现我页面中的策略无济于事,我得到了提到的404错误,好像有些东西丢失了.
我甚至下载了那里发布的代码,它的确有效!
我尝试比较两个代码,但实际上看不出有什么区别.但是,我在这里粘贴我的代码,希望你能帮我解决这个问题.
WEB.CONFIG
<add key="ida:Tenant" value="PlataformaXXX.onmicrosoft.com" />
<add key="ida:ClientId" value="84d2a6e6-4cac-4c53-a5ff-XXXXXXXXXXXX" />
<add key="ida:AadInstance" value="https://login.microsoftonline.com/{0}/v2.0/.well-known/openid-configuration?p={1}" />
<add key="ida:RedirectUri" value="https://localhost:59744/" />
<add key="ida:SignUpPolicyId" value="B2C_1_Sign_Up" />
<add key="ida:SignInPolicyId" value="B2C_1_Sign_In" />
<add key="ida:UserProfilePolicyId" value="B2C_1_Edit" />
Run Code Online (Sandbox Code Playgroud)
STARTUP.AUTH.CS
public partial class Startup
{
// App config settings
private static string clientId = ConfigurationManager.AppSettings["ida:ClientId"];
private static string aadInstance = ConfigurationManager.AppSettings["ida:AadInstance"];
private static string tenant = ConfigurationManager.AppSettings["ida:Tenant"];
private static string redirectUri = ConfigurationManager.AppSettings["ida:RedirectUri"]; …Run Code Online (Sandbox Code Playgroud) .htaccess ×1
angularjs ×1
azure ×1
azure-ad-b2c ×1
c# ×1
client-side ×1
handler ×1
javascript ×1
jquery ×1
laravel ×1
magento ×1
migration ×1
multilingual ×1
php ×1
redirect ×1
session ×1
spring ×1
spring-boot ×1
umbraco ×1
umbraco7 ×1
web ×1