我正试图在rails中设置我的404 ...
我遵循了这些指示
如果做的事情似乎有效:
www.myapp.com/no_controller/
但如果我这样做:
www.myapp.com/existing_controller/no_action
我得到了活动记录,记录未找到......等等......
我希望这也可以路由到404页面...这可能吗?
我即将摆脱我的一个网站上的一些模板.这些模板下有很多页面
city.php?city_id=1
city.php?city_id=2
city.php?city_id=3
...
Run Code Online (Sandbox Code Playgroud)
告诉Google该页面不再存在的正确方法是什么,以便将该页面从索引中删除?
谢谢!
首先让我说我已禁用并清除缓存并注销并重新登录.但是,我仍然收到此错误.
其次,让我解释一下我要做的事情.顺便说一下,这是我的第一个扩展构建:)我只是想构建一个扩展,如果它被启用它将覆盖原始的cart/shipping.phtml文件与我自己的模板文件..
我可以在管理员配置下的左侧边栏中看到我的扩展程序.但是,当我点击我的扩展程序以提取允许您禁用或启用它的常规选项卡时,我找不到可怕的404页面.你能看看我的代码,让我知道我做错了什么吗?感谢所有帮助的人!
这是我的所有文件:)
等/ config.xml中
<?xml version="1.0"?>
<config>
<modules>
<Beckin_DropDownShipping><version>1.0.0</version></Beckin_DropDownShipping>
</modules>
<global>
<blocks>
<dropdownshipping>
<class>Beckin_DropDownShipping_Block</class>
</dropdownshipping>
</blocks>
<helpers>
<dropdownshipping>
<class>Beckin_DropDownShipping_Helper</class>
</dropdownshipping>
</helpers>
</global>
<frontend>
<layout>
<updates>
<beckin>
<file><!-- beckin_dropdownshipping.xml --></file>
</beckin>
</updates>
</layout>
<routers>
<dropdownshipping>
<use>standard</use>
<args>
<module>Beckin_DropDownShipping</module>
<frontName>dropdownshipping</frontName>
</args>
</dropdownshipping>
</routers>
</frontend>
<adminhtml>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<dropdownshipping_options>
<title>Beckin Drop Down Shipping Extension</title>
</dropdownshipping_options>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</adminhtml>
</config>
Run Code Online (Sandbox Code Playgroud)
等/的system.xml
<?xml version="1.0"?>
<config>
<tabs>
<beckin translate="label">
<label>Beckin Extensions</label>
<sort_order>100</sort_order> …Run Code Online (Sandbox Code Playgroud) 我有这个代码,如果我去 /time/ 会给出我的自定义 404 错误消息,但如果我去 /times/ 或只是 / 或 /whatever 然后我会得到默认的 404 错误消息。我想为除 /time/ 以外的所有情况显示我的自定义 404
package main
import (
"fmt"
"time"
"flag"
"os"
"net/http"
)
const AppVersion = "timeserver version: 3.0"
func timeserver(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/time/" {
NotFoundHandler(w, r)
return
}
const layout = "3:04:05 PM"
t := time.Now().Local()
fmt.Fprint(w, "<html>\n")
fmt.Fprint(w, "<head>\n")
fmt.Fprint(w, "<style>\n")
fmt.Fprint(w, "p {font-size: xx-large}\n")
fmt.Fprint(w, "span.time {color: red}\n")
fmt.Fprint(w, "</style>\n")
fmt.Fprint(w, "</head>\n")
fmt.Fprint(w, "<body>\n")
//fmt.Fprint(w, "The time is now …Run Code Online (Sandbox Code Playgroud) 我使用自定义永久链接/%category%/%postname%/在类别的页面上(category.php)我使用分页,例如/ shops/paged/2并得到404错误
PS如果我去/ shops/paged/1它工作PPS使用自定义查询WP_Query和wp_pagenavi()
global $paged;
if (get_query_var( 'paged' ))
$my_page = get_query_var( 'paged' );
else {
if( get_query_var( 'page' ) )
$my_page = get_query_var( 'page' );
else
$my_page = 1;
set_query_var( 'paged', $my_page );
$paged = $my_page;
}
$args = array(array('posts_per_page' => 2, 'paged' => $paged, 'post_type' => 'post', 'category_name' => 'my_category_nicename'));
$the_query = new WP_Query( $args );
...
while ( $the_query->have_posts() ):
...
Run Code Online (Sandbox Code Playgroud)
我该如何解决?
非常感谢你!!
我试图在 url 错误时处理 404 错误,http://localhost:8100/#/login。这是我的登录 url,如果我写类似 http:.../loginasdasd 的内容,我想自动打开我自己的 NotFoundPage。
const appRoutes3: Routes = [
{
path: '',
children: [
{
path: 'login',
component: LoginPage
},
{ path: 'login**', redirectTo: '/notfound' }
]
},
{ path: 'notfound', component: NotFoundPage }
];
RouterModule.forRoot(
appRoutes3,
{ enableTracing: true } // <-- debugging purposes only
)
,
IonicModule.forRoot(MyApp, {}, {
links: [
{ component: HomePage, name: "Home", segment: "" },
{ component: LoginPage, name: "Login", segment: "login", defaultHistory: [HomePage] },
{ component: …Run Code Online (Sandbox Code Playgroud) 你好很棒的stackoverflow社区,
为蹩脚的问题道歉。我一直在玩 Go 中的 net/http 包,并试图设置一个http.Handle来提供目录的内容。我的句柄代码是
func main() {
http.Handle("/pwd", http.FileServer(http.Dir(".")))
http.HandleFunc("/dog", dogpic)
err := http.ListenAndServe(":8080", nil)
if err != nil {
panic(err)
}
}
Run Code Online (Sandbox Code Playgroud)
我的 dogpic 处理程序正在使用os.Open和http.ServeContent,它工作正常。
但是,当我尝试浏览localhost:8080/pwd时,找不到 404 页面,但是当我将模式更改为 route to 时/,如
http.Handle("/", http.FileServer(http.Dir(".")))
Run Code Online (Sandbox Code Playgroud)
它显示当前页面的内容。有人可以帮我弄清楚为什么fileserver它不能与其他模式一起使用,而只能使用/吗?
谢谢你。
我正在学习 angular,我正在尝试将资产文件夹内的本地图像加载到 main.component.html 中,并且我已经正确设置了路径,同时我在打开图像的路径上执行 alt+单击。但是图像没有加载到浏览器上。
在 Chrome 开发者工具的源选项卡中,没有 包含资产文件夹
我试过这个https://github.com/angular/angular-cli/issues/5268但没有用,有人请帮忙这是我的 angular.json 文件
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"game-of-thrones": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/game-of-thrones",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css",
"./node_modules/bootstrap/dist/css/bootstrap.min.css",
"./node_modules/font-awesome/css/font-awesome.css"
],
"scripts": [
"./node_modules/jquery/dist/jquery.min.js",
"./node_modules/bootstrap/dist/js/bootstrap.min.js"
]
},
"configurations": …Run Code Online (Sandbox Code Playgroud) 我在尝试使用该pytube软件包从 YouTube 下载视频时遇到问题。
我收到一个"HTTP Error 404: Not Found"错误。有人熟悉这个错误吗?我一直在尝试对此进行研究,但尚未找到导致问题的任何原因。
我将分享我的代码和以下错误:
from pytube import YouTube
video = YouTube("https://youtu.be/sflWFZKFJgk")
print(video.title)
print("downloading...")
video.streams.get_highest_resolution().download()
print('Downloaded successfully!')
Run Code Online (Sandbox Code Playgroud)
错误:
HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 404: Not Found
Run Code Online (Sandbox Code Playgroud) 我正在尝试通过此 URL https://finance.yahoo.com/quote/AAPL/key-statistics?p=AAPL从雅虎财经中抓取数据。运行下面的python代码后,我得到以下HTML响应
import numpy as np
import pandas as pd
from bs4 import BeautifulSoup
import requests, lxml
from lxml import html
stockStatDict = {}
stockSymbol = 'AAPL'
URL = 'https://finance.yahoo.com/quote/'+ stockSymbol + '/key-statistics?p=' + stockSymbol
page = requests.get(URL)
print(page.text)
<!DOCTYPE html>
<html lang="en-us"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>Yahoo</title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimal-ui">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<style>
html {
height: 100%;
}
body {
background: #fafafc url(https://s.yimg.com/nn/img/sad-panda-201402200631.png) 50% 50%;
background-size: cover;
height: 100%;
text-align: center;
font: 300 18px …Run Code Online (Sandbox Code Playgroud) http ×3
angular ×2
go ×2
python ×2
adminhtml ×1
assets ×1
block ×1
handler ×1
magento ×1
module ×1
pagination ×1
permalinks ×1
pytube ×1
web-scraping ×1
wordpress ×1