天道酬勤,学无止境

apache

Magento 媒体网址 - 摆脱 403 Forbidden(Magento media url - get rid of 403 Forbidden)

问题 在我的 Magento 网站(不是真正的 url ;) ),我有 http://magento.local.com/media/ 作为 403 Forbidden 返回。 这似乎是所有 Magento 安装的标准,但我想改变这一点,而不是为对 /media/ 的请求返回 403。 我怎样才能做到这一点? 编辑:(添加更多信息和原因) 我希望 /media/ 不是 403,这样我就可以将请求重定向到 /media/ 到 /media/index.html。 我认为一旦 403 得到解决,这种重定向会很容易,但不幸的是,事实并非如此。 例如 RewriteRule ^$ /index.html [L,NC,R=301] 根本不重定向 /media/,并显示通常的“/ 索引”。 解决方案:将 DirectoryIndex 添加到 htaccess 文件 谢谢保罗 回答1 将.htaccess放入您的media/目录,内容如下: Options All +Indexes DirectoryIndex index.html 回答2 有什么需要注意的。 媒体目录的标准 Magento .htaccess 如下: Options All -Indexes <IfModule mod_php5.c> php_flag engine 0 </IfModule> # AddHandler cgi

2021-10-27 04:02:42    分类:技术分享    apache   magento   magento-1.4

将 index 和 index.php 视为同一个文件(Treating index and index.php as the same file)

问题 我正在使用 Apache 2.2.22 和 PHP 5.3.10 处理 PHP 项目,但遇到了 index 和 index.php 被视为同一个文件的问题。 我有一个 admin/index.php,它重定向到 admin/index 以允许我在 .htaccess 中的 mod_rewrite 规则接管并将请求重新路由到自定义框架中。 问题是,当浏览器转到 admin/index 时,它会进入无限重定向循环,因为请求被发送到 admin/index.php,然后重定向到 admin/index 我已经尝试删除 htaccess 文件,看看我的 mod_rewrite 规则是否有问题导致它并且它没有改变任何东西。 它只是无休止地重定向到 admin/index。 我以前从未听说过这种行为,浏览一些 Google 结果并浏览 apache 配置文件并没有显示任何明显的东西。 有没有人以前见过这个并知道如何解决它? 编辑:下面是 index.php 用于重定向到索引的代码。 <?php header("Location: index"); die(); 回答1 这可能是由于启用了 MultiViews: MultiViews的作用如下:如果服务器收到/some/dir/foo的请求,如果/some/dir开启了MultiViews,而/some/dir/foo不存在

2021-10-27 04:01:54    分类:技术分享    php   apache   .htaccess   mod-rewrite   indexing

Django deployment with Apache on AWS -- Directory Structure

I have a django app with the following structure web/ manage.py settings.py wsgi.py urls.py /subapp1/ /subapp2/ When deployed on the development server runserver, everything links and works correctly. When I deploy the entire web app, none of my webpages are served. There is no 500 or 404 error. And the error logs only show: [notice] caught SIGTERM, shutting down [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations I have the following set up for my Apache2.2.2: wsgi.py: import os import sys import site site.addsitedir('/home/ubuntu/.virtualenvs

2021-10-27 03:31:35    分类:问答    python   django   apache   amazon-web-services   apache2

Change font size in text box - apache poi word docx

I found the answer that explains how to insert a new text box into docx document. create text box in document .docx using apache poi The problem is that I cannot change the font size inside a newly created text box. Does anyone know how to do that?

2021-10-27 03:23:32    分类:问答    apache   textbox   ms-word   apache-poi   docx

Very simple mod_rewrite questions

1- Does mod_rewrite means that if I make this url: domain.com/ad.php?id=8498292 INTO domain.com/8498292 that all links on my website will have to be changed to the later above? example the link: domain.com/ad.php?id=8498292 wont work now, unless I replace it with domain.com/8498292 ? Or will the server know that they are the same still? 2- Will the rewritten link appear rewritten in the browsers adress bars also, so if I enter domain.com/ad.php?id=8498292 it will actually appear as domain.com/8498292 in the adress bar itself? 3- Will images and all other related links and material on the page

2021-10-27 03:22:02    分类:问答    php   html   linux   apache   .htaccess

End of script output before headers Apache 2.4 Error

We have just upgraded to Apache 2.4 from 2.2 and our fastcgi apps are now causing the error message 'End of script output before headers'. All the apps and libraries, which are all in C, have been recompiled using the latest libraries from fastcgi.com and they worked fine before the upgrade. Any clues as to the cause of the problem would be appreciated. The server is Fedora 19 As it turned out the problem was with a shared object file that wasn't of the correct version. For some odd reason that error did not show in the log. So, question should be closed.

2021-10-27 03:14:11    分类:问答    c   apache

How can an Apache user write files when having permissions to do it?

I'm with a web application that let anonymous users to upload images, transform them and get them later. I have a directory with www-data group owner and 1770 permissions, where the images are uploaded. In Apache configuration, AllowOverride set to none and Options to -Indexes. The input validation is controlled, so would be difficult to exploit. The question is: How could anyone write files in that directory (if input validation is controlled), where Apache user has permissions to do it? And what changes when the permissions are set to 777?

2021-10-27 03:05:57    分类:问答    php   apache   permissions

Url routing errors in php in codeigniter

My login form on front page is displayed, but when it posts to other pages, the post does not happen. THe problem is that the url is like: http://sitename/users/action which is a 404 not found url. But when i hard code the path to controller, (that is, stop using base_url + "/users/action" and use base_url + "/system/application/controllers/users/action") it starts working. How can i fix this problem?

2021-10-27 02:42:09    分类:问答    apache   codeigniter   routing   url

在读取正文之前拒绝 HTTP 请求(Rejecting a HTTP request before reading the body)

问题 我正在一个网站上工作,用户需要上传一些非常大的文件。 该网站是用 PHP 编写的。 在某些情况下,我想拒绝基于标题的文件。 理想情况下,我想在收到标头后立即拒绝请求,而无需阅读正文。 如果标头足以表明应该拒绝该文件,则没有理由读取 200M 文件。 此外,当我接受请求时,我想定期保存在收到请求正文时读取的字节数。 我知道这对 PHP 来说是不可能的,因为在 PHP 得到它之前读取了整个 HTTP 请求。 我的选择是什么? 我从未使用过 Perl,但我读到 mod_perl 可以访问 Apache API。 是否可以使用 mod_perl 来做到这一点? 一个 Apache 模块? 回答1 使用标准的 PHP 处理程序在很大程度上是不可能的。 在解析请求之前您不会收到请求,遗憾的是没有好的方法可以推迟它。 编辑:我在使用 commons fileupload 库的流模式和 java.util 方面有很好的经验。 合并到 Apache 配置中有点麻烦,但如果您正在谈论 200M 文件,则非常值得节省带宽。 回答2 如果您可以硬编码拒绝文件的规则,则可以在 .htaccess 中使用 mod_rewrite 规则。 使用 %{HTTP: header } 条件: RewriteCond %{HTTP:AcceptThisFile} False [NC] RewriteRule (

2021-10-27 01:38:00    分类:技术分享    apache   http   mod-perl

php-apcu (CGI/FastCGI) apc_fetch always return false

When using the php-apcu (https://github.com/krakjoe/apcu) extension (not apc) in a php CGI environment the stored data fromapc_store are empty. Anyone has experiences on how to solve this issue? Example PHP File: test-apc.php <?php $k = 'test'; if(isset($_GET['get'])) { $result = apc_fetch($k); echo "Read entry '$k': $result"; } else if(isset($_GET['clear'])) { echo "Clear entry '$k'"; apc_clear_cache('user'); } else { apc_store($k, "HelloWord"); echo "Write entry '$k' set"; } print_r(apc_cache_info('user')); ?> Steps to reproduce: Open http://server/test-apc.php to call apc_store Open http:/

2021-10-27 01:17:02    分类:问答    php   apache   apc