使用 OS X 10.9.1 和 AMPPS 2.1(日期为 2013 年 11 月 18 日)我可以启动 Apache 服务器,但是当尝试转到管理或配置页面时,我收到 localhost/ampps-admin 和 localhost/ampps 的 404 错误。
我应该去哪里寻找这个问题?
我正在尝试编写一个 shell 脚本,使用 cURL 下载文件并检测 url 是否导致 404 错误。如果 url 是 404,那么我想将 url 链接或文件名保存到文本文件中。
url 格式为http://server.com/somefile[00-31].txt
我一直在搞乱我在谷歌上找到的内容,目前有以下代码:
#!/bin/bash
if curl --fail -O "http://server.com/somefile[00-31].mp4"
then
echo "$var" >> "files.txt"
else
echo "Saved!"
fi
Run Code Online (Sandbox Code Playgroud) 我有一个 Symfony 操作,当查询返回 NULL 时,我试图返回 404 错误。
我总是会返回常规页面的模板和 200 HTTP 返回代码。
我已经检查过,我的错误日志显示 createNotFoundException 正在触发。
我正在运行 Symfony 2.7.1
知道为什么此代码不返回 404 页面吗?
<?php
namespace Example\GroupBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Component\HttpFoundation\Request;
use Example\GroupBundle\Entity\Group;
/**
* Class SupportGroupLandingController
* @package Example\GroupBundle\Controller
*
* @Route("/group")
*/
class SupportGroupController extends Controller
{
/**
* @Route("/{name}", name="support_group_page")
* @Method("GET")
* @Template("ExampleGroupBundle::group_page.html.twig")
*
* @param $name
* @return array
*/
public function indexAction($name)
{
$repo = $this->getDoctrine()->getRepository('ExampleGroupBundle:Group');
$group = $repo->findOneBy(array('name' => $name));
if …Run Code Online (Sandbox Code Playgroud) 在我的 github 页面上获取这些错误代码。我将这些作为加载脚本的顺序:
<script src="../../node_modules/jquery/dist/jquery.js"></script>
<script src="../../js/bootstrap.min.js"></script>
<script src="../../js/index.js"></script>
Run Code Online (Sandbox Code Playgroud)
以下是错误消息:
GET https://tmolano.github.io/CareerMod4/node_modules/jquery/dist/jquery.js 404 ()
index.html:115 GET https://tmolano.github.io/CareerMod4/node_modules/popper.js/dist/popper.min.js 404 ()
util.js:56 Uncaught TypeError: Cannot read property 'fn' of undefined
at util.js:56
at util.js:10
at bootstrap.min.js:6
at bootstrap.min.js:6
(anonymous) @ util.js:56
(anonymous) @ util.js:10
(anonymous) @ bootstrap.min.js:6
(anonymous) @ bootstrap.min.js:6
Run Code Online (Sandbox Code Playgroud)
这是我的页面: https: //tmolano.github.io/CareerMod4/
除了加载顺序之外,还有什么可能导致此问题?
任何人都可以帮助我在 Laravel 5.7 中创建自定义 404 页面,我是 Laravel 的新手,所以如果您告诉我此流程,那就太好了。
谢谢
看起来,当我创建新路由时,尝试访问 url 时收到 404 错误,这很有趣。因为我的所有其他路线都运行良好。
我的 web.php 看起来像这样:
Auth::routes();
Route::post('follow/{user}', 'FollowsController@store');
Route::get('/acasa', 'HomeController@index')->name('acasa');
Route::get('/{user}', 'ProfilesController@index')->name('profil');
Route::get('/profil/{user}/edit', 'ProfilesController@edit')->name('editareprofil');
Route::patch('/profil/{user}', 'ProfilesController@update')->name('updateprofil');
Route::get('/alerte', 'PaginaAlerte@index')->name('alerte');
Route::get('/alerte/url/{user}', 'UrlsController@index')->name('editurl');
Route::post('/alerte/url/{user}', 'UrlsController@store')->name('updateurl');
Route::get('/alerte/url/{del_id}/delete','UrlsController@destroy')->name('deleteurl');
Run Code Online (Sandbox Code Playgroud)
当我访问http://127.0.0.1:8000/alerte时不起作用的是:
Route::get('/alerte', 'PaginaAlerte@index')->name('alerte');
Run Code Online (Sandbox Code Playgroud)
控制器看起来像这样:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Auth;
class PaginaAlerte extends Controller
{
public function __construct() {
$this->middleware('auth');
}
public function index(User $user)
{
return view('alerte');
}
}
Run Code Online (Sandbox Code Playgroud)
我正在摇头,因为我看不出问题所在。这还不是一个实时网站,我只是在我的 Windows 10 电脑上使用 WAMP 进行开发。
我的网站有一个使用 AJAX 嵌入的搜索过滤器表单。当我使用简单类型参数访问页面时,它会返回内容,但是当我尝试使用 GET 传递其他参数时,它会显示 404。 示例: http://www.website.com/?type =871 (它显示默认内容) http://www.website.com/?type=871&controller=abc(返回404)
Jquery Ajax 代码
$.ajax({
type: 'GET',
url: $(this).attr('action') + '?type=871',
data: $(this).serialize(),
success: function (data) {
$('#searchresults').html(data);
}
});
Run Code Online (Sandbox Code Playgroud)
打字稿代码
mlAjax = PAGE
mlAjax {
typeNum = 871
}
[globalVar = GP:type = 871]
config {
disableAllHeaderCode = 1
xhtml_cleaning = 0
admPanel = 0
debug = 0
no_cache = 1
}
tt_content.list.10 >
// Insert content that can handle the request
mlAjax {
10 = …Run Code Online (Sandbox Code Playgroud) 创建了一个开箱即用的 ASP.NET Core 5.0 Web 应用程序 - 在本地运行得很好。
将项目发布到文件夹并将内容复制到运行 IIS 的 Windows Server 2019。
安装了ASP.NET Core 5.0 运行时 (v5.0.5) - Windows 托管捆绑包。
应用程序池:.NET CLR版本:为无托管代码管理,管道模式:为集成
项目文件包含:
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
webBuilder.UseStaticWebAssets();
});
Run Code Online (Sandbox Code Playgroud)
启动包含:
app.UseStaticFiles();
Run Code Online (Sandbox Code Playgroud)
引用时,wwwroot 文件夹下的所有内容都会抛出 404 错误:
https://servername.test.com/subapplication/css/site.css
Run Code Online (Sandbox Code Playgroud)
默认页面确实已加载,只是由于未找到文件而没有样式。
例如:
Dir结构
localhost/
|- test/
|- index.php
|- .htaccess
Run Code Online (Sandbox Code Playgroud)
index.php:
<?php
if(isset($_GET['cmd'])){
echo "cmd is ok";
}
?>
Run Code Online (Sandbox Code Playgroud)
的.htaccess
RewriteEngine On
RewriteRule ^([^/]*)/$ /test/index.php?cmd=$1 [L]
Run Code Online (Sandbox Code Playgroud)
如果用户设置: http://localhost/test/index.php?cmd=a
输出将是: cmd is ok
那没问题!
如果用户设置,我想得到相同的结果http://localhost/test/a
应该如何设置.htaccess/mod_rewrite?
有了代码,我只得到404.
我很确定我忽略了一些显而易见的事情,但我不确定是什么.我正在构建一个简单的Web应用程序,提供模板化的书籍页面.模板工作正常,图像的路径似乎正确填充,但我不断为图像本身收到404错误.
这是模板:
<h1>{{.Title}}</h1>
<h2>{{.Author.Name}}</h2>
<image src="../images/{{.ImageURI}}" />
Run Code Online (Sandbox Code Playgroud)
这是应用程序本身:
package main
import (
"html/template"
"log"
"net/http"
"time"
"github.com/gorilla/mux"
"github.com/user/marketplace/typelibrary"
)
var books []typelibrary.Book
func ItemHandler(w http.ResponseWriter, r *http.Request) {
params := mux.Vars(r)
var selected typelibrary.Book
//Retrieve item data
for _, item := range books {
if item.ID == params["id"] {
selected = item
break
}
}
t, _ := template.ParseFiles("./templates/book.html")
t.Execute(w, selected)
}
func main() {
router := mux.NewRouter()
books = append(books, typelibrary.Book{ID: "1", Title: "The Fellowship of the Ring", ImageURI: …Run Code Online (Sandbox Code Playgroud) php ×2
static-files ×2
.htaccess ×1
ajax ×1
apache ×1
bash ×1
curl ×1
go ×1
html ×1
javascript ×1
laravel ×1
laravel-5.7 ×1
mod-rewrite ×1
shell ×1
symfony ×1
typo3 ×1
webserver ×1