Difference between revisions of "Apache Redirection"

From Ilianko
Line 13: Line 13:
 
  </VirtualHost>
 
  </VirtualHost>
 
Да стане:
 
Да стане:
 +
<code><pre>
 
  <VirtualHost *:80>
 
  <VirtualHost *:80>
 
         RewriteEngine on
 
         RewriteEngine on
Line 18: Line 19:
 
         RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
 
         RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
 
  </VirtualHost>
 
  </VirtualHost>
 +
</pre></code>

Revision as of 15:09, 13 October 2013

Да се редактират настройките на web директорията. За default директорията

файлът:
:~$ nano /etc/apache2/sites-enables/000-default

ot:

<VirtualHost *:80>
       ServerAdmin contact@yourwebsite.com

       DocumentRoot /var/www/public

       <Directory />
...
</VirtualHost>

Да стане:

 <VirtualHost *:80>
        RewriteEngine on
        ReWriteCond %{SERVER_PORT} !^443$
        RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
 </VirtualHost>