我想要做的和我被卡住的是: 我有一个Apache服务器,将抓住某些url,并为他们中的一些,他将使用ProxyPass(或mod_rewrite)作为反向代理传递给另一个Apache实例。 所以我有这样的url: /index.php/info?format=xml&token=SOMENUMERICTOKEN&token=SUMENUMERICTOKEN 我试过了 : PassProxy /index.php/info?format=xml https://1.2.3.4:567/index.php/info?format=xml 和相关的ProxyReverse,但它不工作 也尝试用相同的行重写和[P]结束代理。 他们没有工作。 他们会工作,如果我以/index.php结束,但我不能允许访问index.php
服务器:Debian Jessie Apache:2.4.9-1 PHP:5.5 我想要的是所有非文件和非目录redirect到我自己处理它们的index.php。 由于我的项目的性质,我必须从一个虚拟主机内部工作。 我正在使用虚拟主机(vHosts)和mod_rewrite在我正在工作的Web项目。 这是vHost文件… <VirtualHost *:80> ServerName foo.com ServerAlias www.foo.com ServerAdmin [email protected] DocumentRoot /srv/foo/main/www/ ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php [L] </IfModule> </VirtualHost> vHost按预期工作,重写规则将请求redirect到index.php。 但是当我尝试访问服务器上的文件时,例如: foo.com/css/style.css 位于: /srv/foo/main/www/css/style.css 我的请求被redirect到index.php 这很奇怪,因为重写条件语句应该解决这个问题。 所有文件夹权限都设置为755,所有文件都设为644。 我已经能够毫无疑问地确认重写条件是不匹配的。 我可以通过查看Apache的错误日志,并为mod_rewrite启用debugging输出来看到这一点。 为什么两个RewriteCond语句不正确匹配? 他们可能没有看到vHost DocumentRoot? 更新:closures重写引擎允许我到我正在testing的文件。 IE,我的URI是正确的。 我知道我的路是好的,条件只是因为某种原因失败了。
我有一个Apache 2.2服务器和* .domain.com的通配符SSL证书,并为80和443设置了一个mod_rewrite规则集,可以正确地将domain.com的请求redirect到www.domain.com: RewriteCond %{HTTP_HOST} ^domain.com RewriteRule ^(.*)$ https://www.domain.com$1 [R=permanent,L] (这是443的那个; 80上的那个只是在'https'中省略了's')。 这个部分对于http和https都是正确的 – 它重写 – 但是这并不能解决我想要修复的问题。 特别是,当有人去https://domain.com ,他们会得到一个证书警告,因为* .domain.com通配符证书不匹配只有domain.com。 如果他们select接受证书并继续,则重写将正常进行,并且正常的locking图标replace愤怒的locking图标。 问题是,他们首先得到警告 – 他们必须select在重写完成之前忽略证书警告。 在尝试执行SSL协商之前,是否有正确的方法将stream量发送到https://domain.com到https://www.domain.com ? 看起来像mod_rewrite正在做这件事。
在我的一台机器上,我有一个内部服务器,在8090端口进行侦听。 我在Apache中使用virtualhost来使用像servera.mydomain.com这样的URL来代理内部服务器: <VirtualHost *:443> ServerAlias servera.mydomain.com ProxyPass / http://localhost:8090/ nocanon ProxyPassReverse / http://localhost:8090/ … </VirtualHost> 这效果很好,当我从浏览器打开https://servera.mydomain.com ,它将我redirect到http://localhost:8090/ 。 问题是,服务器中的所有URL都以ReportServer开始,因此我实际上必须键入https://servera.mydomain.com/ReportServer才能访问它,这很麻烦。 我努力了: RewriteEngine on RewriteRule ^(.*)$ ReportServer/$1 但是,在日志中只有404错误没有很好的解释。 在虚拟主机的所有URL中放置ReportServer前缀的正确方法是什么? 我可以select前缀是否对浏览器可见吗?
这是驱使我坚果,我不明白这是如何工作自动。 我有nginx作为我的networking服务器,我已经安装了URL重写的Joomla从URL删除index.php 。 之前,当我使用Apache时,必须使用RewriteEngine On启用.htaccess才能使其工作。 但对于Nginx,当启用“使用URL重写”时,它会自动运行。 我只使用将php文件传递给php-fpm的Nginx。 就这样。 我没有添加任何特殊的重写规则,而不是Joomla文档中给出的。 我不明白“启用URL重写”是如何自动启用的,因为Nginx没有.htaccess。 关于这个主题的Joomla文档没有帮助。 它在第二步说 启用使用Apache mod_rewrite / URL重写选项并保存:此选项使用Apache mod_rewrite函数来消除URL的“index.php”部分。 ….. 如果此选项导致错误,请参阅如何检查您的服务器上是否启用了mod重写。 如果未启用,并且您有权访问文件apache / conf / httpd.conf,请打开该文件并检查LoadModule行rewrite_module modules / mod_rewrite.so是否未注释。 如有必要,取消注释该行并重新启动Apache Web服务器。 不知道为什么这是在Nginxconfiguration中添加的,因为在Nginx中没有mod_rewrite。 Joomla后端的URL重写如下: 使用URL重写select使用服务器的重写引擎来捕获满足特定条件的URL,并按照指示重写它们。 适用于IIS 7和Apache。 仅限Apache用户! 激活之前,将htaccess.txt重命名为.htaccess。 将web.config.txt重命名为web.config,然后在激活之前安装IIS URL重写模块。 它没有提到Nginx,但仍然有效。 我在这里挠着脑袋。 有人能告诉我Joomla的index.php如何轻松地在Nginx中删除? 这是我的Nginx Vhostconfiguration: server { listen 80; server_name example.com; root /var/www/example/public_html; index index.php index.html index.htm […]
我试图用Apache 2.2.22静态HTML设置一个网站,但我得到一个500错误,而不是404。 错误日志中的消息是: [Sun Dec 14 09:48:45 2014] [error]由于可能的configuration错误,请求超出了10个内部redirect的限制。 如果需要,使用“LimitInternalRecursion”来增加限制。 使用“LogLeveldebugging”来获得回溯。 当我设置LogLeveldebugging我看到 [Sun Dec 14 09:48:45 2014] [debug] core.c(3112): r->uri = /home/nxad/index.php [Sun Dec 14 09:48:45 2014] [debug] core.c(3118): redirected from r->uri = /home/nxad/index.php [Sun Dec 14 09:48:45 2014] [debug] core.c(3118): redirected from r->uri = /home/nxad/index.php [Sun Dec 14 09:48:45 2014] [debug] core.c(3118): redirected from […]
Arch-Linux上的Apache有问题。 我认为这是相关的mod_rewrite,但我不知道。 过去我一直使用基于Debian的系统。 拱似乎有点不同。 我有一个这样的虚拟主机,并在各自的目录index.php。 我尝试了和没有.htaccess。 <VirtualHost *:80> ServerName test.localhost DocumentRoot /home/me/sites/test <Directory /home/me/sites/test> Options FollowSymLinks AllowOverride All </Directory> </VirtualHost> 当我访问http://test.localhost/或http://test.localhost/index.php ,它工作正常。 当我访问http://test.localhost/foo ,它找不到404。 我可以用ErrorDocument 404 /index.php添加一个.htaccess,所以Apache会打开index.php并正确的遵循.htaccess的mod_rewrite指令,但是它仍然有404头文件。 任何想法要寻找什么?
mod_rewrite正在我的系统上运行,但我仍然在apache2 error_logs错误。 me@server:# ls /etc/apache2/mods-enabled | grep rewrite rewrite.load rewrite.load的内容 LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so 错误日志 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/mod_rewrite.so.' – /usr/lib/php5/20090626/mod_rewrite.so.: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/mod_rewrite.so.' – /usr/lib/php5/20090626/mod_rewrite.so.: cannot open […]
我试图让他的主机名后面有一个参数,如下所示: www.domain.com/parameter 出于这个原因,我已经设置了下面的rewriteRule,我想使用两个参数值: RewriteRule ^(en|pt)$ /index.php?language=$1&%{QUERY_STRING} [L] 工作正常! 虽然,我需要创build一个新的规则,redirect任何请求没有列出的参数。 出于这个原因,我认为这将工作: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !^(en|pt)$ RewriteRule ^(.*)$ /pt/$1/ [L,R=301] 但不幸的是显示redirect循环。 我已经得到: http://hostname/pt/pt/pt/pt/pt/pt/pt/pt/pt/pt/pt/pt/pt/pt/pt/pt/pt/pt/pt/pt/pt// 任何提示如何解决这个赞赏!
我使用的是java和apache,我在我的安全页面上托pipe非安全的第三方内容,当我在Facebook上分享我的页面时,facebooks选项卡不显示不安全的内容。 我碰到一篇描述这种行为的文章,我正在寻找纠正这个问题。 https://www.tabsite.com/blog/chrome-and-other-browsers-not-showing-insecure-content/ 由于我的内容提供商不提供安全的内容,我的想法是使用Apache将我的安全URL代理给第三方非安全URL。 我将如何去做我的代理dynamic,以便我不会一致地修改我的服务器映像? 我最初的想法是在我的域名之前加上第三方url https://images.example.com?url=http://content-provider.com/image/1234.jpg 并parsing它与Apache重写或其他东西,但我不知道这是一个合适的解决scheme。 我正在寻找一些想法和build议。 我如何使用mod_rewrite重写URL到查询参数? 我试着写下面的代码,但没有成功 https://images.example.com?url=http://content-provider.com/image/1234.jpg RewriteCond %{QUERY_STRING} ^url=(.*)$ [NC] RewriteRule (.*)$ %1 [NC,L,R=301] 我希望http://content-provider.com/image/1234.jpg