X
X
xverizex2020-02-25 20:31:07
Apache HTTP Server
xverizex, 2020-02-25 20:31:07

How to set up a redirect from http to https so that all requests are accepted by index.php?

Nothing works. Vaughn configured apache according to different manuals. Server on a laptop. the site redirect goes to my laptop. Here is the virtual host setup.

<IfModule mod_ssl.c>
<VirtualHost *:80>
  ServerName brokenheads.ru
  DocumentRoot /var/www/brokenheads.ru
</VirtualHost>
<VirtualHost *:443>
  # The ServerName directive sets the request scheme, hostname and port that
  # the server uses to identify itself. This is used when creating
  # redirection URLs. In the context of virtual hosts, the ServerName
  # specifies what hostname must appear in the request's Host: header to
  # match this virtual host. For the default virtual host (this file) this
  # value is not decisive as it is used as a last resort host regardless.
  # However, you must set it for any further virtual host explicitly.
  ServerName brokenheads.ru

  ServerAdmin [email protected]
  DocumentRoot /var/www/brokenheads.ru

  # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
  # error, crit, alert, emerg.
  # It is also possible to configure the loglevel for particular
  # modules, e.g.
  #LogLevel info ssl:warn

  ErrorLog ${APACHE_LOG_DIR}/brokenheads.ru.error.log
  CustomLog ${APACHE_LOG_DIR}/brokenheads.ru.access.log combined

  SSLEngine on
  SSLProtocol all -SSLv2

  SSLCertificateFile    /home/cf/ssl/brokenheads.ru.pem
        SSLCertificateKeyFile /home/cf/ssl/brokenheads.ru.key

  <FilesMatch "\.(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars
  </FilesMatch>
  <Directory /usr/lib/cgi-bin>
    SSLOptions +StdEnvVars
  </Directory>
  # For most configuration files from conf-available/, which are
  # enabled or disabled at a global level, it is possible to
  # include a line for only one particular virtual host. For example the
  # following line enables the CGI configuration for this host only
  # after it has been globally disabled with "a2disconf".
  #Include conf-available/serve-cgi-bin.conf
</VirtualHost>
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet


And here is .htaccess in /var/www/brokenheads.ru
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

writes.
Not Found
The requested URL was not found on this server.

I am trying to access brokenheads.ru/install like this and here is my php code.
<?php

spl_autoload_register( function ( $class ) {
    
    include 'app/classes/' . $class . '_class.php';
    
} );

echo $_SERVER['REQUEST_URI'];

/* последняя проверка */
    Route::get ( '/install', function ( $param ) {
        $View = new Install;
        return $View->content;
    });

echo should output the request, but it doesn't. if you access the files directly, it works, but I need all requests to be sent to /index.php. in http, not in https, everything worked fine for me, but here I don’t understand what’s wrong.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2020-02-25
@shambler81

you are trying to combine CNC and redirect into one rule.
It is done in one file, of course, but with different rules
, and so
1 how do you process the PHP URL, as far as I understand, this is GET
, if so, I will write you a rule.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question