【问题标题】:XAMPP URL with 'error' end to 404 Not found带有“错误”的 XAMPP URL 以 404 结尾未找到
【发布时间】:2014-08-19 06:53:36
【问题描述】:

其中包含单词error 的URL 是否存在问题?因为如果我输入像http://eshop.local/controller/action这样的路由,控制器可以是任何东西,没有问题,但如果控制器出错,它会返回:

Error 404 Page not found

我的 htaccess:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]

http://eshop.local/error 可以正常工作,但如果后面跟着某个操作,则无论单词、数字或任何内容都会返回 404 错误。

编辑:

刚才我已经将它复制到我的虚拟主机上,所有带有错误网址的东西都可以正常工作,所以问题出在 XAMPP 方面。

【问题讨论】:

  • 请给我们一个您想放入浏览器的网址的示例,以及它应该重定向的位置。否则很难理解您的要求。谢谢。 :)
  • eshop.local/error/action 应该将我重定向到 index.pgp,其中 $_GET['url'] = 'error/action',在我的虚拟主机上工作,在我的 localhost XAMPP 上返回 404 Not found跨度>
  • 你的xampp主机有/error/目录吗?
  • 嗯,现在是周末,所以我不在家。我会尽快尝试:)

标签: .htaccess mod-rewrite xampp


【解决方案1】:

屏住呼吸

  • 打开xampp控制面板
  • 停止 Apache
  • 单击 Apache 行上的 Config 按钮,然后选择 httpd.conf
  • 在该文件中,搜索<Directory "C:/xampp/htdocs">
  • 再低一点,你可能会看到这样一行:# AllowOverride All。删除#,这是一条评论
  • 保存文件
  • 重启 Apache,祈祷,交叉手指,屏住呼吸

【讨论】:

  • 好的,我试过了,但是没有用。还是同样的问题。
【解决方案2】:

来自 XAMPP 论坛版主 Altrea 的回应:

All URLs that are used in an Alias, Location or Proxy definition.
There are a bunch of them in XAMPP Apache (depending on which config files are activated or not some of them are maybe not used):

/cgi-bin/
/error/
/examples
/icons/
/licenses
/manual
/my-gateway/
/phpmyadmin
/php-cgi/
/security
/server-info
/server-status
/uploads
/webalizer
/webdav

In your case /error/ is already useds

是否可以重用例如 /error/ 或者最好在我的代码中将其更改为 /err/ ?

This Alias is used for the default Apache 
error Pages (everywhere ErrorDocuemnt is used this Alias is used).
So it is possible to change it in XAMPP, but you have to 
search and replace multiple files.

【讨论】:

    猜你喜欢
    • 2018-04-16
    • 1970-01-01
    • 1970-01-01
    • 2014-08-11
    • 2016-05-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多