@xverizex

Как настоить переадресацию с http на https, чтобы все запросы принимал index.php?

Ничего не получается. Вон по разным руководствам настраивал apache. Сервер на ноутбуке. переадресация сайта идет на мой ноутбук. Вот настройка виртуального хоста.
<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 webmaster@localhost
	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


А вот .htaccess в /var/www/brokenheads.ru
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

пишет.
Not Found
The requested URL was not found on this server.

Я пытаюсь обратиться вот так brokenheads.ru/install, и вот мой php код.
<?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 должен вывести запрос, но не выводит. если обращаться напрямую к файлам, то работает, но мне надо, чтобы все запросы отправлялись в /index.php. в http, не в https, у меня все нормально работало, а здесь не пойму что не так.
  • Вопрос задан
  • 52 просмотра
Пригласить эксперта
Ответы на вопрос 1
вы пытаетесь соединить ЧПУ и редирект в одно правило.
Оно делается в одном файле конечно, но разными правилами
и так
1 у вас каким образом обрабатывает урл пхп насколько я понимаю это GET
если да то напишу вам правило.
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы