标签: http-status-code-404

这个403错误重定向有什么问题

您已经为joomla创建了一个error.php,以将404错误重定向到joomla文章.下面的代码适用于404错误,但403返回空白页面.我可以直接导航到我脚本之外的页面,因此它必须是我的代码或它在环境中的交互方式.

谢谢Stephen

defined( '_JEXEC' ) or die( 'Restricted access' );
if ($this->error->code == 404)
{
Header( "HTTP/1.1 404 Not found" );
header("Location: http://www.queensberry.com/misc/filenotfound/");
} else if ($this->error->code == 403) {
Header( "HTTP/1.1 403 Restricted Content" );
Header( "Location: http://www.queensberry.com/restrictedcontent/" ); 
} else {
echo "hello world error code = " . $this->error->code;
}
?>
Run Code Online (Sandbox Code Playgroud)

php joomla webserver http-status-code-403 http-status-code-404

1
推荐指数
2
解决办法
7398
查看次数

rails:404.html未在IE中呈现

我有一个rails应用程序,它将错误的网址重定向到"/".我制作了404.html文件,它有以下代码.

<script type="text/javascript">
  <!--
  window.location = "http://www.mydomain.com/"
  //-->
</script>
Run Code Online (Sandbox Code Playgroud)

它在Firefox中运行良好,但IE不重定向.IE绘制了自己的"无法找到网页".页.

我检查了日志文件,它确实呈现了404.html.

无论IE版本如何,这都会发生.

怎么了?

山姆

internet-explorer ruby-on-rails http-status-code-404

1
推荐指数
1
解决办法
1660
查看次数

Ajax响应调用,404 Not Found

我尝试使用wordpress和codeigniter在最佳CMS和最佳PHP框架之间进行智能连接.实际上我打算使用codeigniter进行数据库管理和wordpress进行显示.但我想在wordpress中使用codeigniter.所以,我有一个像这样的文件树:

www
- codigniter-core folder
  - .htaccess
- wordpress-core folder
- .htaccess
- index.php
Run Code Online (Sandbox Code Playgroud)

我怎么能使wordpress .htaccess也覆盖codeigniter ant而不是jquery ajax调用中的404错误.我目前的wordpress .htaccess文件是:

<IfModule mod_rewrite.c>
Run Code Online (Sandbox Code Playgroud)

RewriteEngine On RewriteBase/RewriteCond%{REQUEST_FILENAME}!-f #RewriteCond%{REQUEST_FILENAME}!-d RewriteCond $ 1!^/codeigniter-core/RewriteRule ^(.*)$ /index.php/$1 [L]

我也试过问这个Wordpress论坛和Codeigniter论坛,但没有答案.我认为这是重写条件或规则的地狱,但我不知道......

ajax wordpress .htaccess codeigniter http-status-code-404

1
推荐指数
2
解决办法
6716
查看次数

ASP.net web.config没有捕获所有404的

在我的web.config中,我有:

    <customErrors mode="On" defaultRedirect="~/Error.aspx" redirectMode="ResponseRewrite">
        <error statusCode="500" redirect="~/Error.aspx" />
        <error statusCode="404" redirect="~/404.aspx" />
    </customErrors>
Run Code Online (Sandbox Code Playgroud)

然而,使用这些URL,只有定义了文件扩展名的第二个工作,另一个返回蓝色屏幕404"应用程序中的服务器错误".

http://127.0.0.1/scirranew/invalidpath

http://127.0.0.1/scirranew/invalidpath.aspx
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?我在ASP.net 4,IIS 7.5上.

asp.net web-config custom-error-pages http-status-code-404

1
推荐指数
1
解决办法
5148
查看次数

关于lighttpd的Django:重定向到.fcgi(404)

我正在将我的django项目部署到一个轻便的服务器上.当我试图访问网站root时,一切都很好,但如果我添加/ admin /或/ blog /我得到:

Page not found (404)
Request Method:     GET
Request URL:    http://x.x.x.x/mysite.fcgi/mysite.fcgi/admin/
Run Code Online (Sandbox Code Playgroud)

和,

Page not found (404)
Request Method:     GET
Request URL:    http://x.x.x.x/mysite.fcgi/mysite.fcgi/blog/
Run Code Online (Sandbox Code Playgroud)

我已经阅读了一些关于此的帖子,似乎可以通过向settings.py添加FORCE_SCRIPT_NAME =""来解决.但是,这对我没有用.

urls.py:

urlpatterns = patterns('',
(r'^$', index),
(r'^blog/$', blog_view),
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
)
Run Code Online (Sandbox Code Playgroud)

lighttpd.conf:

$HTTP["host"] == "x.x.x.x" {
server.document-root = "/home/lighttpd/sedin/web"
fastcgi.server = (
    "/mysite.fcgi" => (
        "main" => (
            # Use host / port instead of socket for TCP fastcgi
            #"host" => "127.0.0.1",
            #"port" => 3033,            
            "socket" => "/home/lighttpd/sedin/sedin.sock",
            "check-local" => …
Run Code Online (Sandbox Code Playgroud)

django fastcgi lighttpd http-status-code-404

1
推荐指数
1
解决办法
1518
查看次数

使用HTML5 File API的IIS7为大文件返回404

我正在尝试按照此示例实现用于图像上载的File API

http://robertnyman.com/html5/fileapi-upload/fileapi-upload.html

在服务器端我使用带有IIS7的ASP.NET MVC 3(集成,仅32位)

使用Development Server和IIS7.5,本地一切正常.在服务器上它也可以工作,除非文件具有一定的大小(使用2.2MB图像文件),上传似乎正在工作,但响应是404页面.我已经将maxRequestLength配置为10MB,但即使使用默认的4MB,它也应该有效.

我得到的404页面默认是IIS7 404,而不是我的应用程序的404页面(通过查看Fiddler或Firebug中的结果).我正在捕获所有随机URL并显示自定义404页面,但在这种情况下,似乎请求未发送到ASP.NET管道(应用程序池设置为集成).

我还记录了可​​能发生的任何异常(包括404) - 就这个问题而言,日志是清楚的.服务器的事件日志中也没有任何内容.

有任何想法吗?

谢谢!

asp.net-mvc html5 iis-7 http-status-code-404 fileapi

1
推荐指数
1
解决办法
1302
查看次数

Spring MVC jsp映射

你好,我是Spring的新手,并坚持我的jsp映射 - 我的页面给出了404 - 找不到页面的错误.

我的项目结构是



    WebContent
     + META-INF
     - WEB-INF
      - jsp
        index.jsp
        login.jsp
      +lib
      springMVC-servlet.xml
      web.xml

Run Code Online (Sandbox Code Playgroud)

在web.xml




     <display-name>spring</display-name>
        <servlet>
             <servlet-name>springMVC</servlet-name>
             <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
            <load-on-startup>1</load-on-startup>  
        </servlet>

     <servlet-mapping>
      <servlet-name>springMVC</servlet-name>
      <url-pattern>/</url-pattern>
     </servlet-mapping>
     <welcome-file-list> 
      <welcome-file>index.jsp</welcome-file> 
    </welcome-file-list>
    </web-app>
    
Run Code Online (Sandbox Code Playgroud)

用SpringMVC-servlet.xml中



    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:context="http://www.springframework.org/schema/context"
     xmlns:mvc="http://www.springframework.org/schema/mvc"
     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
      http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">

        <context:component-scan
            base-package="web.controller" />

     <!-- Enabling Spring MVC configuration through annotations -->
     <mvc:annotation-driven />

        <bean id="viewResolver"
            class="org.springframework.web.servlet.view.InternalResourceViewResolver">
            <property name="prefix" value="/WEB-INF/jsp/" />
            <property name="suffix" value=".jsp" />
        </bean …
Run Code Online (Sandbox Code Playgroud)

spring jsp http-status-code-404

1
推荐指数
1
解决办法
1万
查看次数

尝试使用HttpClient上传文件时,Web Api的RequestEntityTooLarge响应

我正在尝试使用Asp.Net Web Api创建一个通过Post上传文件的Web服务.这些分别是Client和Web Api的实现:

客户:

using (var client = new HttpClient()) {
    client.BaseAddress = new Uri("https://127.0.0.1:44444/");
    using (var content =
       new MultipartFormDataContent("Upload----" + DateTime.Now.ToString(CultureInfo.InvariantCulture))) {
       content.Add(new ByteArrayContent(File.ReadAllBytes(filepath)));
       content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
       var response = await client.PostAsync("api/Synchronization", content);

       if (response.IsSuccessStatusCode)
           eventLog1.WriteEntry("Synchronization has been successful", EventLogEntryType.Information);
       else 
           eventLog1.WriteEntry(response.StatusCode + ":" + response.ReasonPhrase, EventLogEntryType.Error);

      }
}
Run Code Online (Sandbox Code Playgroud)

服务器:

public class SynchronizationController : ApiController {

    public HttpResponseMessage SynchronizeCsv() {
        var task = this.Request.Content.ReadAsStreamAsync();
        task.Wait();
        Stream requestStream = task.Result;

        try {
            Stream fileStream = File.Create(HttpContext.Current.Server.MapPath(path));
            requestStream.CopyTo(fileStream); …
Run Code Online (Sandbox Code Playgroud)

c# httpclient http-status-code-404 asp.net-web-api

1
推荐指数
1
解决办法
6630
查看次数

Django为静态文件返回404

在我的本地Mac服务器上运行Django项目时,在尝试访问静态文件时出现404错误.

我的目录结构如下:

myapp/static
Run Code Online (Sandbox Code Playgroud)

在我的settings.py中,我尝试了以下各种组合:

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))

STATICFILES_DIRS = [
    os.path.join(PROJECT_ROOT, 'static'),
    '/var/www/myapp/static',
    '/pycharmprojects/myapp/static'
]

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'django.contrib.staticfiles.finders.FileSystemFinder',
)
Run Code Online (Sandbox Code Playgroud)

对于静态文件的每次使用,我在PyCharm中得到如下错误:

GET /static/img/pastedsvg%2017.svg HTTP/1.1" 404 101
Run Code Online (Sandbox Code Playgroud)

在Firefox中出现如下错误:

GET 
http://127.0.0.1:8888/static/img/pastedsvg%2017.svg [HTTP/1.0 404 NOT FOUND 15ms]
Run Code Online (Sandbox Code Playgroud)

我已经在Stackoverflow中查看了这个问题的其他答案,并尝试了建议,但到目前为止没有任何作用.

python django http-status-code-404

1
推荐指数
1
解决办法
1283
查看次数

如何在Rails应用程序的ruby中添加404错误页面?

你能帮我吗 我想将404错误页面添加到我的网站。我尝试了很多方法,但是对我没有用。这是其中之一。

应用控制器

unless  ActionController::Base.consider_all_requests_local
  rescue_from Exception, :with => :render_404
end

private

  def render_404
    render :template => 'error_pages/404', :layout => false, :status => :not_found
  end
Run Code Online (Sandbox Code Playgroud)

然后设置error_pages / 404.html

谁能解决这个问题?

ruby-on-rails http-status-code-404

1
推荐指数
1
解决办法
542
查看次数