我正在研究一个Drupal多站点,因此,我的redirect被添加到相同的htaccess。 问题是我的RewriteCond工作不正常。 我的example1.com RewriteRule也在example2.com上工作,我不想要。 这些redirect是特定于站点的。 任何人都可以看到我做错了什么? # START redirects of example1.com RewriteCond %{HTTP_HOST} ^stage\.example1\.com [NC,OR] RewriteCond %{HTTP_HOST} ^example1\.com [NC] RewriteRule ^products/new-equipment/marine-engines$ /products/new/marine [R=301,L] # END redirects of example1.com # START redirects of example2.com RewriteCond %{HTTP_HOST} ^stage\.example2\.com [NC,OR] RewriteCond %{HTTP_HOST} ^example2\.com [NC] RewriteRule ^products/new/machines/405/(.*) /products/new [R=301,L] # END redirects of example2.com
我在我的.htaccess文件中使用了这个代码: RewriteEngine On RewriteCond %{HTTP_HOST} ^silkgifts.co.uk RewriteRule (.*) https://www.silkgifts.co.uk/$1 [R=301,L] 它将我的HTTPS非www引导到HTTPS www站点,并将HTTP非www引导到HTTPS www站点。 但是,并不是将HTTP www指向https www。 我也在这个代码中尝试解决这个问题: RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 在谷歌search控制台工作,但在其他网站上testing时,它说有一个无尽的redirect链,所以我删除了它。 谁能告诉我我要去哪里? 编辑:当前.htaccess文件: AddHandler php56-script .php .php5 ## EXPIRES CACHING ## <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access plus 1 year" ExpiresByType image/jpeg "access plus 1 year" ExpiresByType image/gif […]
在我的Drupal的httaccess文件中,我希望每个URL都可能最终redirect到https www site org(注意'和'www') 我可以得到以下工作: www.site自动redirect到https www.site http www.siteredirect到https www.site 我无法得到: https站点redirect到https www.site – 而是转到https站点 http站点自动redirect到https www.site – 而是转到https站点 网站自动redirect到https的网站 – 而是去https网站 到目前为止,这里是httaccess代码: # Set "protossl" to "s" if we were accessed via https://. This is used later # if you enable "www." stripping or enforcement, in order to ensure that # you don't bounce […]
我试图执行HTTPS除了mt4目录。 的public_html /的.htaccess RewriteEngine On RewriteCond %{REQUEST_URI} "/mt4/" # try to skip with the L last flag RewriteRule (.*) $1 [L] RewriteCond %{HTTP_HOST} ^(www\.)(.+) [OR] RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} ^(www\.)?(.+) RewriteRule ^ https://%2%{REQUEST_URI} [R=301,L] 的public_html / MT4 / htaccess的 RewriteEngine On RewriteCond %{HTTPS} on RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [L] 如果我去example.com/mt4/浏览器说: 此页面不起作用 example.comredirect了太多次。 尝试清除您的Cookie。 ERR_TOO_MANY_REDIRECTS HTTPS正在其他地方工作OK!
我试图从名为X-TARGET-URL,其中包含目标URL的HTTP标头获取值。 然后转发该stream量到该url,但它不起作用。 RewriteEngine On RewriteCond "%{HTTP:X-TARGET-URL}" RewriteRule ^(.*)$ %{HTTP:X-TARGET-URL} [P] ProxyPassReverse "/" %{HTTP:X-TARGET-URL} 任何帮助,将不胜感激。
我有Web应用程序运行在本地主机上,并侦听端口5050.我想这个Web应用程序下的URL相对pathdomain.tld / page /应用程序 我试图使用mod_rewrite: <Location /page/app> RewriteEngine on RewriteRule .*$ http://127.0.0.1:5050/$1 [P,QSA,NE] </Location> 这将domain.tld / page / app重写为domain.tld / login,这不是我服务器上的有效URL。 是否有可能扭转重写? 我无法使用ProxyPassReverse,因为当我将请求代理到应用程序时,需要从URL中删除相对path。
我怎样才能在这里转换我的htaccess规则 RewriteRule ^/?([^/]+)/([^/]+)/?$ page-1.php?a=$1&b=$2 [L,QSA] RewriteRule ^/?([^/]+)/([^/]+)/([^/]+)/?$ page-2.php?a=$1&b=$2&c=$3 [L,QSA] 纳入nginx规则? 我试过使用转换器,但我得到以下 winginx location / { rewrite ^/?([^/]+)/([^/]+)/?$ /page-1.php?a=$1&b=$2 break; rewrite ^/?([^/]+)/([^/]+)/([^/]+)/?$ /page-2.php?a=$1&b=$2&c=$3 break; } anilcetin rewrite ^/?([^/]+)/([^/]+)/?$ /page-1.php?a=$1&b=$2 last; rewrite ^/?([^/]+)/([^/]+)/([^/]+)/?$ /page-2.php?a=$1&b=$2&c=$3 last; 但是他们都没有工作,这里有什么问题? 在我的代码这里是一个页面 domain.com?page-1.php?a=a&b=b会变成domain.com/a/b domain.com?page-2.php?a=a&b=b&c=c进入domain.com/a/b/c
我有一个情况,我有一个现有的应用程序托pipe在Apache(主要是HTML静态网站与JavaScript在客户端执行,启动有一些PHP代码),例如example.com。 现在有另一个要求,以不同的URL服务于同一个网站以及一些静态path说example2.com应该真正服务example.com/area1(但保持在浏览器中的URL为example2.com)。 这里的关键标准是example.com有一些标记为example.com的cookie,我想确保即使你从example2.com开始,你仍然可以使用这些(不是一个好主意,但它是一个遗产需要我们必须支持)。 另一件事是这两个域指向相同的物理服务器,由DNS主机条目分开 这里是我尝试过的并且没有工作的东西 使用与example.com和Apache Rewrite Rule相同的DocumentRoot为example2.comconfiguration虚拟主机块 RewriteRule ^/$ /area1 [R] 这对于redirect起作用,但是cookie被标记为example.com域时被丢弃 configurationProxyPass – 所以在example2.com虚拟主机块,我设置为代理 ProxyPass / http://example.com/area1 ProxyPassReverse http://example.com/area1 这根本不起作用,会发生什么事是请求进入无休止的循环调用自己一遍又一遍,最终失败。 我的问题是 是我正在尝试实现的可能(包括使用跨域cookie) 如果是这样,我失踪了什么?
我正在使用Apache作为我的Web应用程序的代理服务器,在Glassfish容器中运行。 我在Apache中configuration了代理密码和SSL。 该网站可以从外部访问URL https://www.my-domain.com没有任何问题。 但是我想在浏览器上调用没有前缀“https://”(www.mydomain.com。)的网站。 如果我不使用https://使用URL,它会在浏览器(Safari,firefox)上给我提供“无法连接到服务器”的错误,并在命令提示符处使用curl: Rebuilt URL to: www.my-domain.com/ Trying 2xx.xxx.xxx.xxx… connect to 2xx.xxx.xxx.xxx port 80 failed: Connection refused 我根据apache文档configuration了虚拟主机,将没有 “https”的任何请求redirect到“https”。 Hier是我的configuration: <VirtualHost 2xx.xxx.xxx.xxx:80> ServerName my-domain.com ServerAlias www.my-domain.com RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule (.*) https://my-domain.com [R,L] </VirtualHost> 有什么我缺less的configuration? 为什么Apache服务器不redirect请求? 任何帮助将不胜感激。 PS。 一旦我用https://从外部调用页面,即使删除了现金,也可以调用它,而不用使用前缀https://。 在VPN或在同一个networking,它的工作没有前缀。
我想redirect到HTTPS的URL当请求来自AWS ELB的HTTP我的重写configuration文件rewrite.config如下 当规则是 RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^.*$ https://%{HTTP:Host}%{REQUEST_URI} 'GET / HTTP/1.1'redirect到'GET https%3A//backend.myserver.com/ HTTP/1.1'但浏览器不显示它。 如下显示添加[R = 301]条件的redirect RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteRule ^.*$ https://%{HTTP:Host}%{REQUEST_URI} [R=301] 那么'GET / HTTP/1.1'redirect到'GET /https%3A//backend.myserver.com/ HTTP/1.1' 但写入无限的请求日志如下 172.31.23.158 – – [22/Aug/2017:11:06:13 +0000] 'GET /https%3A//backend.myserver.com/ HTTP/1.1' 301 – 172.31.23.158 – – [22/Aug/2017:11:06:13 +0000] 'GET /https%3A//backend.myserver.com/https%3A//backend.myserver.com/https%253A//backend.myserver.com/ HTTP/1.1' 301 – 172.31.23.158 – – [22/Aug/2017:11:06:14 +0000] […]