我是Apache新手,无法理解重写规则。 在我的testing服务器上,我有一个任意的Apacheconfiguration,它提供一个Elasticsearch实例来selectIP。 我到目前为止是: <VirtualHost *:80> ServerName home.mytest.server ProxyPass /esearch http://127.0.0.1:9200 ProxyPassReverse /esearch http://127.0.0.1.9200 <Location /esearch> order deny,allow deny from all allow from <my IP> </Location> <Location /esearch/*/_search> #Alter URI in here order deny,allow deny from all allow from <my IP> </Location> </VirtualHost> 我想要做的就是重写所有的请求到/esearch/*/_search在path中包含默认值。 所以/esearch/*/_search被重写为/esearch/myIndex/*/_search 。 我该怎么做呢? 我已经阅读了关于RewriteConditions和Rules的内容,但是它并没有真正地陷入其中。
我正在devise一个基于networking的科学计算平台的服务,涉及上传大量数据文件(很多GB)。 每个文件还包含标头中的cookie,允许我的服务器对用户进行身份validation。 多个用户可能一次上传这些文件。 这些文件必须使用SSL进行encryption,并且将所有请求发送到我们主要的面向Web的域名(这个域名有一个处理所有请求的Apache服务器)是很好的(但不是绝对必要的)。 我们的服务器托pipe在Google Compute引擎上。 我有多个后端服务器用于实际处理数据文件,目前正在使用mod_proxy将数据请求代理到后端服务器。 但是,即使使用代理,所有的数据在被发送到后端服务器之前仍然stream经面向networking的服务器。 这可能很容易陷入面向networking的服务器和我的网站。 我的问题是:这种情况通常如何处理? (对不起,我不是一个IT人,但必须自己实现) 在这些情况下是使用redirect代替代理吗? 我已经尝试了redirect,但原始头信息丢失,后端服务器无法检索身份validationCookie。
我遇到了Apache的问题,不想读取我的重写指令,并根据这些指令重写我的URL。 我有条件和规则直接写入我的Apache httpd.conf文件中: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_URI} Round_2 RewriteRule ^Round_2/(.*)$ /newBuyer/desktop/$1 [R=301,L] RewriteCond %{REQUEST_URI} itemList RewriteRule ^/?(.*)/itemList/(.*)$ /newBuyer/$1/search/$2 [R=301,L] RewriteCond %{REQUEST_URI} eventDetail RewriteRule ^/?(.*)/eventDetail/(.*)$ /newBuyer/$1/event/$2 [R=301,L] </IfModule> 我已经重新加载Apache使用: $ apachectl -k graceful 刷新浏览器caching,redirect不起作用。 我能够使它在我的本地Windows Apache实例上工作,但不能在我的Apache的Cent7实例上工作。 我已经确认重写mod已经加载。
我无法使用以下规则获取mod_rewrite。 RewriteCond "%{SERVER_NAME}" "home.myhome.net" RewriteCond "%{SERVER_PORT}" "^4388$" RewriteRule (.*) https://home.myhome.net:4389%{REQUEST_URI} [QSA,R=301,L] 这个规则是在我的http虚拟主机部分设置的。 问题是,redirect只能在第一次使用。 当我在http端口4388上input不同的URL时,我第二次被redirect到https://home.myhome.net:438 8 / … 例如: 首先我inputhttp://home.myhome.net:4388/pageA我redirect到https://home.myhome.net:4389/pageA 下次我inputhttp://home.myhome.net:4388/pageB并redirect到http://home.myhome.net:4388/pageB 任何想法如何解决这个问题? 我的操作系统细节 root@host:~# dpkg -l|grep apache ii apache2 2.4.18-2ubuntu3.5 amd64 Apache HTTP Server ii apache2-bin 2.4.18-2ubuntu3.5 amd64 Apache HTTP Server (modules and other binary files) ii apache2-data 2.4.18-2ubuntu3.5 all Apache HTTP Server (common files) ii […]
我有多个域被设置为redirect(301)到我的主域。 不过,我知道这些领域中的一些在search引擎优化方面几乎没有任何价值,我想摆脱它们。 但我的一个担心是,在这些领域下可能存在反向链接。 我检查了谷歌分析,并没有出现这些域名,但我决定确认他们会注册,如果他们使用。 不幸的是,在testing中,我的Apache 301redirect似乎没有保留引用的URL。 我知道这在很大程度上取决于客户,但似乎共识是大多数时候这是保留。 在现代浏览器中是否有任何设置指示他们在redirect时删除引用链接? 我在Firefox,Chrome和IE中遇到这种情况。 有什么我可以做的服务器端,可能会影响客户端,以保持引荐? 如果这是一个死胡同,还有什么其他方法来检查这些别名域的反向链接或用法? 这是我的redirect: ## Redirect non www to www RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC] RewriteRule ^(.*)$ https://www.example.com$1 [R=301,L]
我正在尝试在代理发生之前重新编写URL的一部分( https://myfirstdomain.com/lool/https:/alf.mydomain.com/service/wopi/files/uuid?query_params ),我有这个我的默认SSL vhost中的相关部分: <IfModule mod_rewrite.c> RewriteEngine On LogLevel debug rewrite:trace3 RewriteRule ^lool/https:/alf.mydomain.com\/(.*) lool/https://alf.mydomain.com/$1 [QSA,NE] </IfModule> ProxyPass / https://localhost:2323/ ProxyPassReverse / https://localhost:2323/ 我在重写日志中看到这个: applying pattern '^lool/https:/alf.mydomain.com' to uri '/lool/https:/alf.mydomain.com/service/wopi/files/uuid 但在收到这个服务,我看到的URL没有被重写。 对于我在做什么错误的任何线索将感激不尽。 我本质上是试图添加额外/已被我没有访问的基础设施中的代理服务器删除。 编辑:在后端WOPI服务的日志中,它看到请求URL未修改: Request from 127.0.0.1:42035: GET /lool/https:/alf.mydomain.com/service/wopi/files/uuid
这是我遇到的一个奇怪的问题。 我正在使用mod_rewrite重写URL后调用的框架。 如果URI中的字符是重音字符,就像在拉丁字母表中那样,请求永远不会发送到我的框架中,而是服务器出错,出现在404上。我使用Windows机器,所以不知道这是否有一些去做或不做。 只要URI中没有重音字符,就可以毫无问题地将请求发送给框架。 有人可以告诉我这里发生了什么,以及如何解决这个问题? 编辑:这里是我的access.log 2行。 第一行显示了由Apache编码的重音Å ,并且没有通过。 当我将URI中的Å更改为英文“A”时,一切正常。 127.0.0.1 – – [20/Oct/2017:13:50:50 -0400] "GET /actor/%C3%85ker HTTP/1.1" 404 222 127.0.0.1 – – [20/Oct/2017:13:54:48 -0400] "GET /actor/Aker HTTP/1.1" 200 5701 编辑:这些是.htaccess文件中的行 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .* index.php?request=$1 [L,QSA] 这是一个由两个人组成的debugging日志的一部分,显示其中一个mod_rewrite不会将请求转发到我的框架,另一个是。 这是失败的: [Fri Oct 20 17:52:48.119655 2017] [rewrite:trace3] [pid 1620:tid 792] mod_rewrite.c(480): [client 127.0.0.1:52846] […]
我在我的htaccess文件中有以下规则来删除.php扩展名,并做一个301redirect到无扩展名的URL: # To remove .php extension RewriteCond %{THE_REQUEST} ^[AZ]{3,}\ (.*)\.php [NC] RewriteRule ^ %1 [R=301,L] # To check whether the file exists then set it back internally RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^.*$ $0.php [L] 我想在PHP文件上应用以下规则: RewriteRule ^test/([0-9]+)$ test.php?id=$1 [L] 上述规则导致500内部服务器错误。 如果我删除了第一组规则,则第二条规则再次运行。 所以,这两套规则都有一些冲突。
我需要一个重写规则为Apache重写url: http://saftsack.fs.uni-bayreuth.de/~dun3/archives/it/programming/fast-dynamic-property-access-using-reflection-emit/33.html 至 http://saftsack.fs.uni-bayreuth.de/~dun3/archives/fast-dynamic-property-access-using-reflection-emit/33.html 所以,我需要删除“archives”和last /之间的所有/部分,保留/之前的部分和/之后的部分。
基本上我想*.domain.com拉起domain.com/*/ *.domain.com (不redirect)。 我进入了cPanel的子域部分,并为这个域设置了一个通配符。 这似乎是正确的解决,即* .domain.com正在提出domain.com。 我现在在public_html目录中创build了一个htaccess文件,其中包含: Options +FollowSymLinks Options +Indexes RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !www.domain.com$ [NC] RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).domain.com [NC] RewriteRule (.*) %2/$1 [L] 我得到的错误是'500内部服务器错误',有什么想法?