Я в основном хочу перенаправить все www на http.
В моем /etc/apache2/sites-enabled/000-default.conf
:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerName www.rentauto-sofia.com
ServerAlias rentauto-sofia.com
ProxyPass / http://rentauto-sofia.com:8000/
ProxyPassReverse / http://rentauto-sofia.com:8000/
DocumentRoot /var/www
<Directory / >
</Directory>
</VirtualHost>
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Мой .htaccess
файл выглядит так:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
Я пытался поместить мусор в .htaccess file
, но апач как бы игнорирует его.Я включил a2enmod expires
и sudo a2enmod rewrite
Редактировать:
Файл .htaccess
находится в /var/www/html/
.