1

Topic: Help to make RegExp

Translated a site c HTTP on HTTPS, now I need to adjust 301st redirect for all site except a folder/connect/. The redirect in.htaccess for all site looks so: RewriteEngine On RewriteCond % {HTTP:PORT}! ^443$ RewriteRule ^ (. *) $ https://% {HTTP_HOST} % {REQUEST_URI} [L, R=301] Help to write correctly, please, RewriteRule which would describe a redirect of all on light except folder contents www.site.ru/connect/?

2

Re: Help to make RegExp

RewriteEngine On # Force HTTPS for all URIs except '/connect / ' RewriteCond % {HTTPS} off RewriteCond % {THE_REQUEST}!/connect/[NC] RewriteRule ^.* https://% {HTTP_HOST} % {REQUEST_URI} [L, R=301] # Force HTTP for '/connect / ' directory only (optional) RewriteCond % {HTTPS} on RewriteCond % {THE_REQUEST}/connect/[NC] RewriteRule ^.* http://% {HTTP_HOST} % {REQUEST_URI} [L, R=301]

3

Re: Help to make RegExp

Hello, anovokreschenov, you wrote: A> A> RewriteEngine On A># Force HTTPS for all URIs except '/connect / ' A> RewriteCond % {HTTPS} off A> RewriteCond % {THE_REQUEST}!/connect/[NC] A> RewriteRule ^.* https://% {HTTP_HOST} % {REQUEST_URI} [L, R=301] A># Force HTTP for '/connect / ' directory only (optional) A> RewriteCond % {HTTPS} on A> RewriteCond % {THE_REQUEST}/connect/[NC] A> RewriteRule ^.* http://% {HTTP_HOST} % {REQUEST_URI} [L, R=301] A> Generally the site does not open Nirabotait.

4

Re: Help to make RegExp

Hello, sushko, you wrote: S> Generally the site does not open Nirabotait. And in broad gulls of the apache that writes? Played back ( htaccess from the message, created a folder connect) at itself on Apache 2.4.27, all .

5

Re: Help to make RegExp

Hello, sushko, you wrote: S> Generally the site does not open Nirabotait. And mod_rewrite it is connected?

6

Re: Help to make RegExp

Hello, anovokreschenov, you wrote: S>> Generally the site does not open Nirabotait. A> and in broad gulls of the apache that writes? [Tue Dec 19 17:14:56.200071 2017] [:error] [pid 27011] [client 109.252.55.104:50016] PHP Warning: include (): Failed opening ' vacations.php ' for inclusion (include_path = '.:/usr/share/php56:/usr/share/pear ') in /home/u463874/.ru/www/m/index.html on line 25 Essence that root index.html is actually a PHP-script, and in it really is a line include ' vacations.php '; the file vacations.php lies in a site root folder. Why - judging by a broad gull line - it starts to search suddenly not www/, and in www/m/? Such folder at me is not present and never was.

7

Re: Help to make RegExp

Hello, salnicoff, you wrote: S>> Generally the site does not open Nirabotait. S> and mod_rewrite it is connected? Yes, since "the canonical" redirect in.htaccess (not considering mine  with a folder/connect/) is based on mod_rewrite and works

8

Re: Help to make RegExp

Hello, sushko, you wrote: S> [Tue Dec 19 17:14:56.200071 2017] [:error] [pid 27011] [client 109.252.55.104:50016] PHP Warning: include (): Failed opening ' vacations.php ' for inclusion (include_path = '.:/usr/share/php56:/usr/share/pear ') in /home/u463874/.ru/www/m/index.html on line 25 S> the Essence that root index.html is actually a PHP-script, and in it really is a line include ' vacations.php '; the file vacations.php lies in a site root folder. S> why - judging by a broad gull line - it starts to search suddenly not www/, and in www/m/? Such folder at me is not present and never was. , communication with a redirect in htaccess is not tracked, or its contents differ from that a little that has been resulted.

9

Re: Help to make RegExp

Hello, anovokreschenov, you wrote: A> Hm, communication with a redirect in htaccess is not tracked, or its contents differ from that a little that has been resulted. The pancake, I absolutely bad became. Checked an IP address, checked everything, and date - on December, 19th - did not check up. I am sorry... In error_log with my IP address  the today's number is not present any lines; in access_log the last line such: 109.252.55.104 - - [15/Jan/2018:11:19:46 +0300] "GET / HTTP/1.0" 301 230 "-" "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; MDDCJS; rv:11.0) like Gecko" It about something speaks? An IP address - my local.

10

Re: Help to make RegExp

Hello, sushko, you wrote: S> 109.252.55.104 - - [15/Jan/2018:11:19:46 +0300] "GET / HTTP/1.0" 301 230 "-" "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; MDDCJS; rv:11.0) like Gecko" S> It about something speaks? An IP address - my local. Speaks that the server answered with the status 301. You can though the link to give that in the browser to look at a course of performance of request? Otherwise it will be the most infinite branch at this forum))

11

Re: Help to make RegExp

Hello, anovokreschenov, you wrote: A> you Can though the link to give that in the browser to look at a course of performance of request? The link I can not give Since to give the reference, it is necessary to suppose (actually) a site, then to give the reference and to wait from you for the answer - for example, by tomorrow if today at you the working day ended

12

Re: Help to make RegExp

S> the Link I can not give Since to give the reference, it is necessary to suppose (actually) a site, then to give the reference and to wait from you for the answer - for example, by tomorrow if today at you the working day ended Similar things are tested on a subdomain what can be made for pair minutes. And so, it is better not  on https. Literally couple of days ago swung one program from the domain at which the author forgot to prolong SSL. And it was necessary to suffer with the browser to download. And all because of this redirect. It is necessary? In Google to deliver https and let it shows in search as https. And old let on http also walk. What for this compulsion?!

13

Re: Help to make RegExp

Hello, rean, you wrote: R> Similar things are tested on a subdomain what can be made for pair minutes. At me the certificate without support of subdomains R> And so, it is better not  on https. R> What for this compulsion?! On searchengines.ru say what is better to do so

14

Re: Help to make RegExp

S> Help to write correctly, please, RewriteRule which would describe a redirect of all on light except folder contents www.site.ru/connect/? nginx is?

15

Re: Help to make RegExp

Hello, anovokreschenov, you wrote: A> Speaks that the server answered with the status 301. It is better telnet' to come and look at 80th port Further.

16

Re: Help to make RegExp

Hello, maks __, you wrote: S>> Help to write correctly, please, RewriteRule which would describe a redirect of all on light except folder contents www.site.ru/connect/? __> nginx is? No

17

Re: Help to make RegExp

S>>> Help to write correctly, please, RewriteRule which would describe a redirect of all on light except folder contents www.site.ru/connect/? If to register a redirect without a folder connect, works? Other servers on the given apache work on https?

18

Re: Help to make RegExp

Hello, sushko, you wrote: Yes, still such thought: and SNI normally works?

19

Re: Help to make RegExp

Hello, maks __, you wrote: __> If to register a redirect without a folder connect, works? Yes, such variant works here: RewriteEngine On RewriteCond % {HTTP:PORT}! ^443$ RewriteRule ^ (. *) $ https://% {HTTP_HOST} % {REQUEST_URI} [L, R=301] __> Other servers on the given apache work on https? I do not know. My sites work without HTTPS - except the examinee

20

Re: Help to make RegExp

Hello, salnicoff, you wrote: S> Yes, still such thought: and SNI normally works? I do not know that this such. To Vick esteemed on this subject, but plainly understood nothing.

21

Re: Help to make RegExp

22

Re: Help to make RegExp

S> Yes, such variant works here: S> RewriteEngine On S> RewriteCond % {HTTP:PORT}! ^443$ S> RewriteRule ^ (. *) $ https://% {HTTP_HOST} % {REQUEST_URI} [L, R=301] Try these variants: RewriteEngine On RewriteCond % {HTTPS} off RewriteCond % {REQUEST_URI}! (connect) [NC] RewriteRule.* https://% {HTTP_HOST} % {REQUEST_URI} [L, R=301] RewriteEngine On RewriteCond % {HTTP:PORT}! ^443$ RewriteCond % {REQUEST_URI}! (connect) [NC] RewriteRule ^ (. *) $ https://% {HTTP_HOST} % {REQUEST_URI} [L, R=301] Beforehand clean a browser cache. If does not work, look broad gulls of the apache, instead of site broad gulls. Approximately so: \var\log\httpd\ssl_error_log

23

Re: Help to make RegExp

Hello, sushko, you wrote: S>> Yes, still such thought: and SNI normally works? S> I do not know that this such. To Vick esteemed on this subject, but plainly understood nothing. It is such  libraries and SSL protocol that it was possible on one IP and to port to hold some HTTPS-sites. Demands support both on server side, and on client side. By rules, the client is knocked on 443 port, on it one HTTPS-site hangs, there is an exchange of certificates-keys - and all works. If to do SNI the client is knocked on 443 and asks to give it the necessary sert/key, then the client is once again knocked. A counter that at such circuit the client at first tries to come on the first site described in a config of the Apache, and, if at it a problem with  there will be problems with all who on this server lives. At such circuit crookedly tuned server can on HTTP give the necessary site, and on HTTPS - what you costs to the first in a config, accordingly.htaccess htaccess, especially regarding a redirect on HTTP, it will be sent by wood. The server or  a hosting? Broad gulls and global adjustments of the Apache can look?

24

Re: Help to make RegExp

Hello, maks __, you wrote: __> Try these variants: __> RewriteEngine On __> RewriteCond % {HTTPS} off __> RewriteCond % {REQUEST_URI}! (connect) [NC] __> RewriteRule.* https://% {HTTP_HOST} % {REQUEST_URI} [L, R=301] __> RewriteEngine On __> RewriteCond % {HTTP:PORT}! ^443$ __> RewriteCond % {REQUEST_URI}! (connect) [NC] __> RewriteRule ^ (. *) $ https://% {HTTP_HOST} % {REQUEST_URI} [L, R=301] the Second variant worked. Thanks! The subject can be closed.