You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Thomas WILLIAMSON <t-...@eauxdevienne.fr> on 2022/06/08 12:11:54 UTC

[users@httpd] Apache website conversion from alias to virtualhost

Hello,

I have to take over an internal Web server that has been configured by a
colleague who is no longer there. Our developers team asks me to convert
applications URLs from an *Alias* to a *Virtualhosts* (subdomain naming)
system. For instance:

https://srv-intra.mydomain.fr/basecolldev


should become

https://basecolldev.mydomain.fr


My environment specifications:

   - Linux OpenSUSE Leap 15.3
   - Server version: Apache/2.4.51 (Linux/SUSE)
   - PHP 7.4.6 (cli) ( NTS )

*Issue description: *I can connect to https://basecolldev.mydomain.fr
despite some 404 errors showing in access_log file (see at the end of the
post). I have then a 404 error page when clicking the *login* button that
redirects to https://basecolldev.mydomain.fr/login. The login page is found
and displayed properly when I manually modify the URL to
https://basecolldev.mydomain.fr/index.php/login. This means that /index.php
is not required for home page connection but is for browsing the website. I
need to permanently prevent the /index.php suffix to show up in URL.

I describe below what I have configured so far and what remains
unfunctionnal.

I have first created a new vhost file
/etc/apache2/vhost.d/basecolldev-ssl.conf :

<VirtualHost basecolldev.mydomain.fr:443>


>     DocumentRoot "/var/www/BaseCollDev/public"
>     ServerName basecolldev.mydomain.fr
>     ErrorLog /var/log/apache2/basecolldev-error_log
>     TransferLog /var/log/apache2/basecolldev-access_log
>     LogLevel alert rewrite:trace8


>     <Directory /var/www/BaseCollDev/public>
>          #Order allow,deny
>          #allow from all
>          #AllowOverride All
>          Require all granted
>          Options -Indexes -Includes -ExecCGI -FollowSymlinks
>     </Directory>


> </VirtualHost>


I have then commented the lines related to the application Directory tag in
file /etc/apache2/default-server.conf :

DocumentRoot "/var/www"


> <Directory "/var/www">
>     Options FollowSymLinks
>     AllowOverride None
>     <IfModule !mod_access_compat.c>
>             Require all granted
>     </IfModule>
>     <IfModule mod_access_compat.c>
>         Order allow,deny
>         Allow from all
>     </IfModule>
> </Directory>


> Alias /icons/ "/usr/share/apache2/icons/"
> Alias /phpmyadmin "/srv/www/htdocs/phpMyAdmin"


> <Directory "/usr/share/apache2/icons">
>     Options Indexes MultiViews
>     AllowOverride None
>     <IfModule !mod_access_compat.c>
>         Require all granted
>     </IfModule>
>     <IfModule mod_access_compat.c>
>         Order allow,deny
>         Allow from all
>     </IfModule>
> </Directory>


>
> #<Directory "/var/www/BaseCollDev/public">
> #        AllowOverride All
> #        Require all granted
> #</Directory>


> ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"


> <Directory "/srv/www/cgi-bin">
>     AllowOverride None
>     Options +ExecCGI -Includes
>     <IfModule !mod_access_compat.c>
>         Require all granted
>     </IfModule>
>     <IfModule mod_access_compat.c>
>         Order allow,deny
>         Allow from all
>     </IfModule>
> </Directory>


> <IfModule mod_userdir.c>
>     UserDir public_html
>     Include /etc/apache2/mod_userdir.conf
> </IfModule>


> IncludeOptional /etc/apache2/conf.d/*.conf


> IncludeOptional /etc/apache2/conf.d/apache2-manual?conf


----

Extract from /var/log/apache2/basecolldev-access_log file relating to a
connection to the home page:

10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET / HTTP/1.1" 200 54206
> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
> /build/runtime.d94b3b43.js HTTP/1.1" 200 1505
> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/app.13d64c6c.js
> HTTP/1.1" 200 236
> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/2.9935185b.css
> HTTP/1.1" 200 64639
> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/app.6cefaab5.css
> HTTP/1.1" 200 163752
> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/2.28b18d57.js
> HTTP/1.1" 200 261268
> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
> /build/images/logoEdVBlanc.png HTTP/1.1" 200 6579
> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /_wdt/b07606 HTTP/1.1"
> 404 1280
> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
> /build/fonts/fa-solid-900.e8a427e1.woff2 HTTP/1.1" 200 78196
> 10.9.4.140 - - [03/Jun/2022:11:02:32 +0200] "GET /favicon.ico HTTP/1.1"
> 404 1280
> 10.9.4.140 - - [03/Jun/2022:11:02:32 +0200] "GET /_wdt/b07606 HTTP/1.1"
> 404 1280
> 10.9.4.140 - - [03/Jun/2022:11:02:33 +0200] "GET /_wdt/b07606 HTTP/1.1"
> 404 1280
> 10.9.4.140 - - [03/Jun/2022:11:02:34 +0200] "GET /_wdt/b07606 HTTP/1.1"
> 404 1280
> 10.9.4.140 - - [03/Jun/2022:11:02:35 +0200] "GET /_wdt/b07606 HTTP/1.1"
> 404 1280


Extract from /var/log/apache2/basecolldev-access_log file relating to a
connection to the login page:

10.9.4.140 - - [03/Jun/2022:11:03:47 +0200] "GET /login HTTP/1.1" 404 1280


I see no logs in /var/log/apache2/basecolldev-error_log file.

I enclose .htaccess files contents if necessary.

File /var/www/.htaccess :

# BEGIN WordPress
> <IfModule mod_rewrite.c>
>     RewriteEngine On
>     RewriteBase /
>     RewriteRule ^index\.php$ - [L]
>     RewriteCond %{REQUEST_FILENAME} !-f
>     RewriteCond %{REQUEST_FILENAME} !-d
>     RewriteRule . /index.php [L]
> </IfModule>
> # END WordPress


File /var/www/BaseCollDev/public/.htaccess :

DirectoryIndex index.php


> <IfModule mod_negotiation.c>
>  Options -MultiViews
> </IfModule>


> <IfModule mod_rewrite.c>
>     RewriteEngine On


>     RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$
>     RewriteRule .* - [E=BASE:%1]


>     RewriteCond %{HTTP:Authorization} .+
>     RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]


>     RewriteCond %{ENV:REDIRECT_STATUS} =""
>     RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]


>     RewriteCond %{REQUEST_FILENAME} !-f
>     RewriteRule ^ %{ENV:BASE}/index.php [L]
>  </IfModule>


>  <IfModule !mod_rewrite.c>
>      <IfModule mod_alias.c>
>         RedirectMatch 307 ^/$ /index.php/
>      </IfModule>
>  </IfModule>



Please note this case has been described here
<https://stackoverflow.com/questions/72487821/apache-website-conversion-from-alias-to-virtualhost>
but has not received any help so far.


--


Thomas WILLIAMSON • Technicien Systèmes et réseaux

*Tél.* 05 49 61 25 25 (*interne *: 2235)

*Eaux de Vienne - Siveer* • 55 rue de Bonneuil-Matours • 86000 Poitiers

Re: [users@httpd] Apache website conversion from alias to virtualhost

Posted by Thomas WILLIAMSON <t-...@eauxdevienne.fr>.
Hello,

I eventually managed to make it functional, by following:

   - File /etc/apache2/default-server.conf within <Directory
"/var/www"> : Allow
   Override *None* becomes Allow Override *All*
   - File /etc/apache2/vhosts.d/basecoll-ssl.conf within <Directory
   /var/www/BaseCollDev/public> : Options -Indexes -Includes -ExecCGI
   -FollowSymlinks becomes Options -Indexes -Includes -ExecCGI

@Yehuda Katz <ye...@ymkatz.net> : I have removed the -FollowSymlinks option
as mentioned above, as it is declared in the default-server.conf
file within <Directory "/var/www"> .

@Franck Gingras <th...@apache.org> : the error log message indeed guided
me on the -FollowSymlinks option (as the other -SymLinksIfOwnerMatch option
didn't occur in my config files). But to be honest, I didn't exactly
understand the issue, as I lack enough time to properly learn Apache
configuration basics.

I thank you all for precious help!

Thomas


--


Thomas WILLIAMSON • Technicien Systèmes et réseaux

*Tél.* 05 49 61 25 25 (*interne *: 2235)

*Eaux de Vienne - Siveer* • 55 rue de Bonneuil-Matours • 86000 Poitiers


Le mer. 8 juin 2022 à 14:52, Frank Gingras <th...@apache.org> a écrit :

> As for the error log entry, it does tell you what to do exactly to fix the
> issue. Do you understand it?
>
> On Wed, 8 Jun 2022 at 08:51, Eric Covener <co...@gmail.com> wrote:
>
>> > <VirtualHost basecolldev.mydomain.fr:443>
>>
>> avoid hostnames in VirtualHost tags.  If you don't care what IP
>> address the connection comes in on, use *:443.
>>
>> On Wed, Jun 8, 2022 at 8:12 AM Thomas WILLIAMSON
>> <t-...@eauxdevienne.fr> wrote:
>> >
>> > Hello,
>> >
>> > I have to take over an internal Web server that has been configured by
>> a colleague who is no longer there. Our developers team asks me to convert
>> applications URLs from an Alias to a Virtualhosts (subdomain naming)
>> system. For instance:
>> >
>> >> https://srv-intra.mydomain.fr/basecolldev
>> >
>> >
>> > should become
>> >
>> >> https://basecolldev.mydomain.fr
>> >
>> >
>> > My environment specifications:
>> >
>> > Linux OpenSUSE Leap 15.3
>> > Server version: Apache/2.4.51 (Linux/SUSE)
>> > PHP 7.4.6 (cli) ( NTS )
>> >
>> > Issue description: I can connect to https://basecolldev.mydomain.fr
>> despite some 404 errors showing in access_log file (see at the end of the
>> post). I have then a 404 error page when clicking the login button that
>> redirects to https://basecolldev.mydomain.fr/login. The login page is
>> found and displayed properly when I manually modify the URL to
>> https://basecolldev.mydomain.fr/index.php/login. This means that
>> /index.php is not required for home page connection but is for browsing the
>> website. I need to permanently prevent the /index.php suffix to show up in
>> URL.
>> >
>> > I describe below what I have configured so far and what remains
>> unfunctionnal.
>> >
>> > I have first created a new vhost file
>> /etc/apache2/vhost.d/basecolldev-ssl.conf :
>> >
>> >> <VirtualHost basecolldev.mydomain.fr:443>
>> >>
>> >>
>> >>     DocumentRoot "/var/www/BaseCollDev/public"
>> >>     ServerName basecolldev.mydomain.fr
>> >>     ErrorLog /var/log/apache2/basecolldev-error_log
>> >>     TransferLog /var/log/apache2/basecolldev-access_log
>> >>     LogLevel alert rewrite:trace8
>> >>
>> >>
>> >>     <Directory /var/www/BaseCollDev/public>
>> >>          #Order allow,deny
>> >>          #allow from all
>> >>          #AllowOverride All
>> >>          Require all granted
>> >>          Options -Indexes -Includes -ExecCGI -FollowSymlinks
>> >>     </Directory>
>> >>
>> >>
>> >> </VirtualHost>
>> >
>> >
>> > I have then commented the lines related to the application Directory
>> tag in file /etc/apache2/default-server.conf :
>> >
>> >> DocumentRoot "/var/www"
>> >>
>> >>
>> >> <Directory "/var/www">
>> >>     Options FollowSymLinks
>> >>     AllowOverride None
>> >>     <IfModule !mod_access_compat.c>
>> >>             Require all granted
>> >>     </IfModule>
>> >>     <IfModule mod_access_compat.c>
>> >>         Order allow,deny
>> >>         Allow from all
>> >>     </IfModule>
>> >> </Directory>
>> >>
>> >>
>> >> Alias /icons/ "/usr/share/apache2/icons/"
>> >> Alias /phpmyadmin "/srv/www/htdocs/phpMyAdmin"
>> >>
>> >>
>> >> <Directory "/usr/share/apache2/icons">
>> >>     Options Indexes MultiViews
>> >>     AllowOverride None
>> >>     <IfModule !mod_access_compat.c>
>> >>         Require all granted
>> >>     </IfModule>
>> >>     <IfModule mod_access_compat.c>
>> >>         Order allow,deny
>> >>         Allow from all
>> >>     </IfModule>
>> >> </Directory>
>> >>
>> >>
>> >>
>> >> #<Directory "/var/www/BaseCollDev/public">
>> >> #        AllowOverride All
>> >> #        Require all granted
>> >> #</Directory>
>> >>
>> >>
>> >> ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"
>> >>
>> >>
>> >> <Directory "/srv/www/cgi-bin">
>> >>     AllowOverride None
>> >>     Options +ExecCGI -Includes
>> >>     <IfModule !mod_access_compat.c>
>> >>         Require all granted
>> >>     </IfModule>
>> >>     <IfModule mod_access_compat.c>
>> >>         Order allow,deny
>> >>         Allow from all
>> >>     </IfModule>
>> >> </Directory>
>> >>
>> >>
>> >> <IfModule mod_userdir.c>
>> >>     UserDir public_html
>> >>     Include /etc/apache2/mod_userdir.conf
>> >> </IfModule>
>> >>
>> >>
>> >> IncludeOptional /etc/apache2/conf.d/*.conf
>> >>
>> >>
>> >> IncludeOptional /etc/apache2/conf.d/apache2-manual?conf
>> >
>> >
>> > ----
>> >
>> > Extract from /var/log/apache2/basecolldev-access_log file relating to a
>> connection to the home page:
>> >
>> >> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET / HTTP/1.1" 200 54206
>> >> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
>> /build/runtime.d94b3b43.js HTTP/1.1" 200 1505
>> >> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
>> /build/app.13d64c6c.js HTTP/1.1" 200 236
>> >> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/2.9935185b.css
>> HTTP/1.1" 200 64639
>> >> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
>> /build/app.6cefaab5.css HTTP/1.1" 200 163752
>> >> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/2.28b18d57.js
>> HTTP/1.1" 200 261268
>> >> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
>> /build/images/logoEdVBlanc.png HTTP/1.1" 200 6579
>> >> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /_wdt/b07606
>> HTTP/1.1" 404 1280
>> >> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
>> /build/fonts/fa-solid-900.e8a427e1.woff2 HTTP/1.1" 200 78196
>> >> 10.9.4.140 - - [03/Jun/2022:11:02:32 +0200] "GET /favicon.ico
>> HTTP/1.1" 404 1280
>> >> 10.9.4.140 - - [03/Jun/2022:11:02:32 +0200] "GET /_wdt/b07606
>> HTTP/1.1" 404 1280
>> >> 10.9.4.140 - - [03/Jun/2022:11:02:33 +0200] "GET /_wdt/b07606
>> HTTP/1.1" 404 1280
>> >> 10.9.4.140 - - [03/Jun/2022:11:02:34 +0200] "GET /_wdt/b07606
>> HTTP/1.1" 404 1280
>> >> 10.9.4.140 - - [03/Jun/2022:11:02:35 +0200] "GET /_wdt/b07606
>> HTTP/1.1" 404 1280
>> >
>> >
>> > Extract from /var/log/apache2/basecolldev-access_log file relating to a
>> connection to the login page:
>> >
>> >> 10.9.4.140 - - [03/Jun/2022:11:03:47 +0200] "GET /login HTTP/1.1" 404
>> 1280
>> >
>> >
>> > I see no logs in /var/log/apache2/basecolldev-error_log file.
>> >
>> > I enclose .htaccess files contents if necessary.
>> >
>> > File /var/www/.htaccess :
>> >
>> >> # BEGIN WordPress
>> >> <IfModule mod_rewrite.c>
>> >>     RewriteEngine On
>> >>     RewriteBase /
>> >>     RewriteRule ^index\.php$ - [L]
>> >>     RewriteCond %{REQUEST_FILENAME} !-f
>> >>     RewriteCond %{REQUEST_FILENAME} !-d
>> >>     RewriteRule . /index.php [L]
>> >> </IfModule>
>> >> # END WordPress
>> >
>> >
>> > File /var/www/BaseCollDev/public/.htaccess :
>> >
>> >> DirectoryIndex index.php
>> >>
>> >>
>> >> <IfModule mod_negotiation.c>
>> >>  Options -MultiViews
>> >> </IfModule>
>> >>
>> >>
>> >> <IfModule mod_rewrite.c>
>> >>     RewriteEngine On
>> >>
>> >>
>> >>     RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$
>> >>     RewriteRule .* - [E=BASE:%1]
>> >>
>> >>
>> >>     RewriteCond %{HTTP:Authorization} .+
>> >>     RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
>> >>
>> >>
>> >>     RewriteCond %{ENV:REDIRECT_STATUS} =""
>> >>     RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
>> >>
>> >>
>> >>     RewriteCond %{REQUEST_FILENAME} !-f
>> >>     RewriteRule ^ %{ENV:BASE}/index.php [L]
>> >>  </IfModule>
>> >>
>> >>
>> >>  <IfModule !mod_rewrite.c>
>> >>      <IfModule mod_alias.c>
>> >>         RedirectMatch 307 ^/$ /index.php/
>> >>      </IfModule>
>> >>  </IfModule>
>> >
>> >
>> >
>> > Please note this case has been described here but has not received any
>> help so far.
>> >
>> >
>> > --
>> >
>> >
>> > Thomas WILLIAMSON • Technicien Systèmes et réseaux
>> >
>> > Tél. 05 49 61 25 25 (interne : 2235)
>> >
>> > Eaux de Vienne - Siveer • 55 rue de Bonneuil-Matours • 86000 Poitiers
>>
>>
>>
>> --
>> Eric Covener
>> covener@gmail.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>>

Re: [users@httpd] Apache website conversion from alias to virtualhost

Posted by Frank Gingras <th...@apache.org>.
As for the error log entry, it does tell you what to do exactly to fix the
issue. Do you understand it?

On Wed, 8 Jun 2022 at 08:51, Eric Covener <co...@gmail.com> wrote:

> > <VirtualHost basecolldev.mydomain.fr:443>
>
> avoid hostnames in VirtualHost tags.  If you don't care what IP
> address the connection comes in on, use *:443.
>
> On Wed, Jun 8, 2022 at 8:12 AM Thomas WILLIAMSON
> <t-...@eauxdevienne.fr> wrote:
> >
> > Hello,
> >
> > I have to take over an internal Web server that has been configured by a
> colleague who is no longer there. Our developers team asks me to convert
> applications URLs from an Alias to a Virtualhosts (subdomain naming)
> system. For instance:
> >
> >> https://srv-intra.mydomain.fr/basecolldev
> >
> >
> > should become
> >
> >> https://basecolldev.mydomain.fr
> >
> >
> > My environment specifications:
> >
> > Linux OpenSUSE Leap 15.3
> > Server version: Apache/2.4.51 (Linux/SUSE)
> > PHP 7.4.6 (cli) ( NTS )
> >
> > Issue description: I can connect to https://basecolldev.mydomain.fr
> despite some 404 errors showing in access_log file (see at the end of the
> post). I have then a 404 error page when clicking the login button that
> redirects to https://basecolldev.mydomain.fr/login. The login page is
> found and displayed properly when I manually modify the URL to
> https://basecolldev.mydomain.fr/index.php/login. This means that
> /index.php is not required for home page connection but is for browsing the
> website. I need to permanently prevent the /index.php suffix to show up in
> URL.
> >
> > I describe below what I have configured so far and what remains
> unfunctionnal.
> >
> > I have first created a new vhost file
> /etc/apache2/vhost.d/basecolldev-ssl.conf :
> >
> >> <VirtualHost basecolldev.mydomain.fr:443>
> >>
> >>
> >>     DocumentRoot "/var/www/BaseCollDev/public"
> >>     ServerName basecolldev.mydomain.fr
> >>     ErrorLog /var/log/apache2/basecolldev-error_log
> >>     TransferLog /var/log/apache2/basecolldev-access_log
> >>     LogLevel alert rewrite:trace8
> >>
> >>
> >>     <Directory /var/www/BaseCollDev/public>
> >>          #Order allow,deny
> >>          #allow from all
> >>          #AllowOverride All
> >>          Require all granted
> >>          Options -Indexes -Includes -ExecCGI -FollowSymlinks
> >>     </Directory>
> >>
> >>
> >> </VirtualHost>
> >
> >
> > I have then commented the lines related to the application Directory tag
> in file /etc/apache2/default-server.conf :
> >
> >> DocumentRoot "/var/www"
> >>
> >>
> >> <Directory "/var/www">
> >>     Options FollowSymLinks
> >>     AllowOverride None
> >>     <IfModule !mod_access_compat.c>
> >>             Require all granted
> >>     </IfModule>
> >>     <IfModule mod_access_compat.c>
> >>         Order allow,deny
> >>         Allow from all
> >>     </IfModule>
> >> </Directory>
> >>
> >>
> >> Alias /icons/ "/usr/share/apache2/icons/"
> >> Alias /phpmyadmin "/srv/www/htdocs/phpMyAdmin"
> >>
> >>
> >> <Directory "/usr/share/apache2/icons">
> >>     Options Indexes MultiViews
> >>     AllowOverride None
> >>     <IfModule !mod_access_compat.c>
> >>         Require all granted
> >>     </IfModule>
> >>     <IfModule mod_access_compat.c>
> >>         Order allow,deny
> >>         Allow from all
> >>     </IfModule>
> >> </Directory>
> >>
> >>
> >>
> >> #<Directory "/var/www/BaseCollDev/public">
> >> #        AllowOverride All
> >> #        Require all granted
> >> #</Directory>
> >>
> >>
> >> ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"
> >>
> >>
> >> <Directory "/srv/www/cgi-bin">
> >>     AllowOverride None
> >>     Options +ExecCGI -Includes
> >>     <IfModule !mod_access_compat.c>
> >>         Require all granted
> >>     </IfModule>
> >>     <IfModule mod_access_compat.c>
> >>         Order allow,deny
> >>         Allow from all
> >>     </IfModule>
> >> </Directory>
> >>
> >>
> >> <IfModule mod_userdir.c>
> >>     UserDir public_html
> >>     Include /etc/apache2/mod_userdir.conf
> >> </IfModule>
> >>
> >>
> >> IncludeOptional /etc/apache2/conf.d/*.conf
> >>
> >>
> >> IncludeOptional /etc/apache2/conf.d/apache2-manual?conf
> >
> >
> > ----
> >
> > Extract from /var/log/apache2/basecolldev-access_log file relating to a
> connection to the home page:
> >
> >> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET / HTTP/1.1" 200 54206
> >> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
> /build/runtime.d94b3b43.js HTTP/1.1" 200 1505
> >> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/app.13d64c6c.js
> HTTP/1.1" 200 236
> >> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/2.9935185b.css
> HTTP/1.1" 200 64639
> >> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
> /build/app.6cefaab5.css HTTP/1.1" 200 163752
> >> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/2.28b18d57.js
> HTTP/1.1" 200 261268
> >> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
> /build/images/logoEdVBlanc.png HTTP/1.1" 200 6579
> >> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /_wdt/b07606 HTTP/1.1"
> 404 1280
> >> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
> /build/fonts/fa-solid-900.e8a427e1.woff2 HTTP/1.1" 200 78196
> >> 10.9.4.140 - - [03/Jun/2022:11:02:32 +0200] "GET /favicon.ico HTTP/1.1"
> 404 1280
> >> 10.9.4.140 - - [03/Jun/2022:11:02:32 +0200] "GET /_wdt/b07606 HTTP/1.1"
> 404 1280
> >> 10.9.4.140 - - [03/Jun/2022:11:02:33 +0200] "GET /_wdt/b07606 HTTP/1.1"
> 404 1280
> >> 10.9.4.140 - - [03/Jun/2022:11:02:34 +0200] "GET /_wdt/b07606 HTTP/1.1"
> 404 1280
> >> 10.9.4.140 - - [03/Jun/2022:11:02:35 +0200] "GET /_wdt/b07606 HTTP/1.1"
> 404 1280
> >
> >
> > Extract from /var/log/apache2/basecolldev-access_log file relating to a
> connection to the login page:
> >
> >> 10.9.4.140 - - [03/Jun/2022:11:03:47 +0200] "GET /login HTTP/1.1" 404
> 1280
> >
> >
> > I see no logs in /var/log/apache2/basecolldev-error_log file.
> >
> > I enclose .htaccess files contents if necessary.
> >
> > File /var/www/.htaccess :
> >
> >> # BEGIN WordPress
> >> <IfModule mod_rewrite.c>
> >>     RewriteEngine On
> >>     RewriteBase /
> >>     RewriteRule ^index\.php$ - [L]
> >>     RewriteCond %{REQUEST_FILENAME} !-f
> >>     RewriteCond %{REQUEST_FILENAME} !-d
> >>     RewriteRule . /index.php [L]
> >> </IfModule>
> >> # END WordPress
> >
> >
> > File /var/www/BaseCollDev/public/.htaccess :
> >
> >> DirectoryIndex index.php
> >>
> >>
> >> <IfModule mod_negotiation.c>
> >>  Options -MultiViews
> >> </IfModule>
> >>
> >>
> >> <IfModule mod_rewrite.c>
> >>     RewriteEngine On
> >>
> >>
> >>     RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$
> >>     RewriteRule .* - [E=BASE:%1]
> >>
> >>
> >>     RewriteCond %{HTTP:Authorization} .+
> >>     RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
> >>
> >>
> >>     RewriteCond %{ENV:REDIRECT_STATUS} =""
> >>     RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
> >>
> >>
> >>     RewriteCond %{REQUEST_FILENAME} !-f
> >>     RewriteRule ^ %{ENV:BASE}/index.php [L]
> >>  </IfModule>
> >>
> >>
> >>  <IfModule !mod_rewrite.c>
> >>      <IfModule mod_alias.c>
> >>         RedirectMatch 307 ^/$ /index.php/
> >>      </IfModule>
> >>  </IfModule>
> >
> >
> >
> > Please note this case has been described here but has not received any
> help so far.
> >
> >
> > --
> >
> >
> > Thomas WILLIAMSON • Technicien Systèmes et réseaux
> >
> > Tél. 05 49 61 25 25 (interne : 2235)
> >
> > Eaux de Vienne - Siveer • 55 rue de Bonneuil-Matours • 86000 Poitiers
>
>
>
> --
> Eric Covener
> covener@gmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] Apache website conversion from alias to virtualhost

Posted by Eric Covener <co...@gmail.com>.
> <VirtualHost basecolldev.mydomain.fr:443>

avoid hostnames in VirtualHost tags.  If you don't care what IP
address the connection comes in on, use *:443.

On Wed, Jun 8, 2022 at 8:12 AM Thomas WILLIAMSON
<t-...@eauxdevienne.fr> wrote:
>
> Hello,
>
> I have to take over an internal Web server that has been configured by a colleague who is no longer there. Our developers team asks me to convert applications URLs from an Alias to a Virtualhosts (subdomain naming) system. For instance:
>
>> https://srv-intra.mydomain.fr/basecolldev
>
>
> should become
>
>> https://basecolldev.mydomain.fr
>
>
> My environment specifications:
>
> Linux OpenSUSE Leap 15.3
> Server version: Apache/2.4.51 (Linux/SUSE)
> PHP 7.4.6 (cli) ( NTS )
>
> Issue description: I can connect to https://basecolldev.mydomain.fr despite some 404 errors showing in access_log file (see at the end of the post). I have then a 404 error page when clicking the login button that redirects to https://basecolldev.mydomain.fr/login. The login page is found and displayed properly when I manually modify the URL to https://basecolldev.mydomain.fr/index.php/login. This means that /index.php is not required for home page connection but is for browsing the website. I need to permanently prevent the /index.php suffix to show up in URL.
>
> I describe below what I have configured so far and what remains unfunctionnal.
>
> I have first created a new vhost file /etc/apache2/vhost.d/basecolldev-ssl.conf :
>
>> <VirtualHost basecolldev.mydomain.fr:443>
>>
>>
>>     DocumentRoot "/var/www/BaseCollDev/public"
>>     ServerName basecolldev.mydomain.fr
>>     ErrorLog /var/log/apache2/basecolldev-error_log
>>     TransferLog /var/log/apache2/basecolldev-access_log
>>     LogLevel alert rewrite:trace8
>>
>>
>>     <Directory /var/www/BaseCollDev/public>
>>          #Order allow,deny
>>          #allow from all
>>          #AllowOverride All
>>          Require all granted
>>          Options -Indexes -Includes -ExecCGI -FollowSymlinks
>>     </Directory>
>>
>>
>> </VirtualHost>
>
>
> I have then commented the lines related to the application Directory tag in file /etc/apache2/default-server.conf :
>
>> DocumentRoot "/var/www"
>>
>>
>> <Directory "/var/www">
>>     Options FollowSymLinks
>>     AllowOverride None
>>     <IfModule !mod_access_compat.c>
>>             Require all granted
>>     </IfModule>
>>     <IfModule mod_access_compat.c>
>>         Order allow,deny
>>         Allow from all
>>     </IfModule>
>> </Directory>
>>
>>
>> Alias /icons/ "/usr/share/apache2/icons/"
>> Alias /phpmyadmin "/srv/www/htdocs/phpMyAdmin"
>>
>>
>> <Directory "/usr/share/apache2/icons">
>>     Options Indexes MultiViews
>>     AllowOverride None
>>     <IfModule !mod_access_compat.c>
>>         Require all granted
>>     </IfModule>
>>     <IfModule mod_access_compat.c>
>>         Order allow,deny
>>         Allow from all
>>     </IfModule>
>> </Directory>
>>
>>
>>
>> #<Directory "/var/www/BaseCollDev/public">
>> #        AllowOverride All
>> #        Require all granted
>> #</Directory>
>>
>>
>> ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"
>>
>>
>> <Directory "/srv/www/cgi-bin">
>>     AllowOverride None
>>     Options +ExecCGI -Includes
>>     <IfModule !mod_access_compat.c>
>>         Require all granted
>>     </IfModule>
>>     <IfModule mod_access_compat.c>
>>         Order allow,deny
>>         Allow from all
>>     </IfModule>
>> </Directory>
>>
>>
>> <IfModule mod_userdir.c>
>>     UserDir public_html
>>     Include /etc/apache2/mod_userdir.conf
>> </IfModule>
>>
>>
>> IncludeOptional /etc/apache2/conf.d/*.conf
>>
>>
>> IncludeOptional /etc/apache2/conf.d/apache2-manual?conf
>
>
> ----
>
> Extract from /var/log/apache2/basecolldev-access_log file relating to a connection to the home page:
>
>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET / HTTP/1.1" 200 54206
>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/runtime.d94b3b43.js HTTP/1.1" 200 1505
>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/app.13d64c6c.js HTTP/1.1" 200 236
>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/2.9935185b.css HTTP/1.1" 200 64639
>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/app.6cefaab5.css HTTP/1.1" 200 163752
>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/2.28b18d57.js HTTP/1.1" 200 261268
>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/images/logoEdVBlanc.png HTTP/1.1" 200 6579
>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /_wdt/b07606 HTTP/1.1" 404 1280
>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/fonts/fa-solid-900.e8a427e1.woff2 HTTP/1.1" 200 78196
>> 10.9.4.140 - - [03/Jun/2022:11:02:32 +0200] "GET /favicon.ico HTTP/1.1" 404 1280
>> 10.9.4.140 - - [03/Jun/2022:11:02:32 +0200] "GET /_wdt/b07606 HTTP/1.1" 404 1280
>> 10.9.4.140 - - [03/Jun/2022:11:02:33 +0200] "GET /_wdt/b07606 HTTP/1.1" 404 1280
>> 10.9.4.140 - - [03/Jun/2022:11:02:34 +0200] "GET /_wdt/b07606 HTTP/1.1" 404 1280
>> 10.9.4.140 - - [03/Jun/2022:11:02:35 +0200] "GET /_wdt/b07606 HTTP/1.1" 404 1280
>
>
> Extract from /var/log/apache2/basecolldev-access_log file relating to a connection to the login page:
>
>> 10.9.4.140 - - [03/Jun/2022:11:03:47 +0200] "GET /login HTTP/1.1" 404 1280
>
>
> I see no logs in /var/log/apache2/basecolldev-error_log file.
>
> I enclose .htaccess files contents if necessary.
>
> File /var/www/.htaccess :
>
>> # BEGIN WordPress
>> <IfModule mod_rewrite.c>
>>     RewriteEngine On
>>     RewriteBase /
>>     RewriteRule ^index\.php$ - [L]
>>     RewriteCond %{REQUEST_FILENAME} !-f
>>     RewriteCond %{REQUEST_FILENAME} !-d
>>     RewriteRule . /index.php [L]
>> </IfModule>
>> # END WordPress
>
>
> File /var/www/BaseCollDev/public/.htaccess :
>
>> DirectoryIndex index.php
>>
>>
>> <IfModule mod_negotiation.c>
>>  Options -MultiViews
>> </IfModule>
>>
>>
>> <IfModule mod_rewrite.c>
>>     RewriteEngine On
>>
>>
>>     RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$
>>     RewriteRule .* - [E=BASE:%1]
>>
>>
>>     RewriteCond %{HTTP:Authorization} .+
>>     RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
>>
>>
>>     RewriteCond %{ENV:REDIRECT_STATUS} =""
>>     RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
>>
>>
>>     RewriteCond %{REQUEST_FILENAME} !-f
>>     RewriteRule ^ %{ENV:BASE}/index.php [L]
>>  </IfModule>
>>
>>
>>  <IfModule !mod_rewrite.c>
>>      <IfModule mod_alias.c>
>>         RedirectMatch 307 ^/$ /index.php/
>>      </IfModule>
>>  </IfModule>
>
>
>
> Please note this case has been described here but has not received any help so far.
>
>
> --
>
>
> Thomas WILLIAMSON • Technicien Systèmes et réseaux
>
> Tél. 05 49 61 25 25 (interne : 2235)
>
> Eaux de Vienne - Siveer • 55 rue de Bonneuil-Matours • 86000 Poitiers



-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache website conversion from alias to virtualhost

Posted by "Paul Kudla (SCOM.CA Internet Services Inc.)" <pa...@scom.ca>.
please note that changing the site around

you will also have to update your dns to point to the webserver

ie : basecolldev.mydomain.fr

needs a dns lookup

otherwise apache virtual hosts would get setup to match

fyi



Happy Wednesday !!!
Thanks - paul

Paul Kudla


Scom.ca Internet Services <http://www.scom.ca>
004-1009 Byron Street South
Whitby, Ontario - Canada
L1N 4S3

Toronto 416.642.7266
Main 1.866.411.7266
Fax 1.888.892.7266
Email paul@scom.ca

On 6/8/2022 12:18 PM, Tom Browder wrote:
> On Wed, Jun 8, 2022 at 07:12 Thomas WILLIAMSON 
> <t-williamson@eauxdevienne.fr <ma...@eauxdevienne.fr>> wrote:
> 
>     Hello,
> 
>     I have to take over an internal Web server that has been configured
>     by a colleague who is no longer there. Our developers team asks me
>     to convert applications URLs from an /Alias/ to a /Virtualhosts/
>     (subdomain naming) system. For instance:
> 
>         https://srv-intra.mydomain.fr/basecolldev
>         <https://srv-intra.mydomain.fr/basecolldev>
> 
> 
>     should become
> 
>         https://basecolldev.mydomain.fr <https://basecolldev.mydomain.fr>
> 
> 
> I am curious as to why they think there is a need for a change since the 
> alias can handle the desired name format. And the alias should be much 
> easier to maintain.
> 
> -Tom
> 
> -- 
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache website conversion from alias to virtualhost

Posted by Tom Browder <to...@gmail.com>.
On Tue, Jun 14, 2022 at 02:24 Thomas WILLIAMSON <
t-williamson@eauxdevienne.fr> wrote:

> @Tom Browder: it seems to be a Symfony and SSO issue. Our developers team
> is facing issues when accessing simultaneously to different applications
> hosted on the server (in different tabs in the same browser). Symfony is
> basing SSO authentication on the domain name and URLs such as
> mydomain.fr/application1 and mydomain.fr/application2 are interpreted as
> being from the same domain (contrarily to URLs such as
> application1.mydomain.fr and application2.mydomain.fr). I do not know
> Symfony and I can't give you any more details on their problematic.
>
> Hope it helps you to understand the need,
>

Thank you, Thomas.

-Tom

Re: [users@httpd] Apache website conversion from alias to virtualhost

Posted by Thomas WILLIAMSON <t-...@eauxdevienne.fr>.
@Tom Browder: it seems to be a Symfony and SSO issue. Our developers team
is facing issues when accessing simultaneously to different applications
hosted on the server (in different tabs in the same browser). Symfony is
basing SSO authentication on the domain name and URLs such as
mydomain.fr/application1 and mydomain.fr/application2 are interpreted as
being from the same domain (contrarily to URLs such as
application1.mydomain.fr and application2.mydomain.fr). I do not know
Symfony and I can't give you any more details on their problematic.

Hope it helps you to understand the need,

Thomas


--


Thomas WILLIAMSON • Technicien Systèmes et réseaux

*Tél.* 05 49 61 25 25 (*interne *: 2235)

*Eaux de Vienne - Siveer* • 55 rue de Bonneuil-Matours • 86000 Poitiers


Le mer. 8 juin 2022 à 18:18, Tom Browder <to...@gmail.com> a écrit :

> On Wed, Jun 8, 2022 at 07:12 Thomas WILLIAMSON <
> t-williamson@eauxdevienne.fr> wrote:
>
>> Hello,
>>
>> I have to take over an internal Web server that has been configured by a
>> colleague who is no longer there. Our developers team asks me to convert
>> applications URLs from an *Alias* to a *Virtualhosts* (subdomain naming)
>> system. For instance:
>>
>> https://srv-intra.mydomain.fr/basecolldev
>>
>>
>> should become
>>
>> https://basecolldev.mydomain.fr
>>
>>
> I am curious as to why they think there is a need for a change since the
> alias can handle the desired name format. And the alias should be much
> easier to maintain.
>
> -Tom
>

Re: [users@httpd] Apache website conversion from alias to virtualhost

Posted by Tom Browder <to...@gmail.com>.
On Wed, Jun 8, 2022 at 07:12 Thomas WILLIAMSON <t-...@eauxdevienne.fr>
wrote:

> Hello,
>
> I have to take over an internal Web server that has been configured by a
> colleague who is no longer there. Our developers team asks me to convert
> applications URLs from an *Alias* to a *Virtualhosts* (subdomain naming)
> system. For instance:
>
> https://srv-intra.mydomain.fr/basecolldev
>
>
> should become
>
> https://basecolldev.mydomain.fr
>
>
I am curious as to why they think there is a need for a change since the
alias can handle the desired name format. And the alias should be much
easier to maintain.

-Tom

Re: [users@httpd] Apache website conversion from alias to virtualhost

Posted by Yehuda Katz <ye...@ymkatz.net>.
You probably need to do exactly what the error message says: You currently
have "-FollowSymlinks" in your options. You can probably just change that
to a + and make sure that it is in the directory configuration for /var/www

- Y

Sent from a device with a very small keyboard and hyperactive autocorrect.

On Wed, Jun 8, 2022, 8:50 AM Thomas WILLIAMSON <t-...@eauxdevienne.fr>
wrote:

> Error log:
>
> [Wed Jun 08 14:45:32.634334 2022] [rewrite:error] [pid 29729] [client
>> 10.9.4.140:55414] AH00670: Options FollowSymLinks and
>> SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also
>> forbidden due to its similar ability to circumvent directory restrictions :
>> /var/www/BaseCollDev/public/
>
>
> Any idea?
>
> Thomas
>
>
> --
>
>
> Thomas WILLIAMSON • Technicien Systèmes et réseaux
>
> *Tél.* 05 49 61 25 25 (*interne *: 2235)
>
> *Eaux de Vienne - Siveer* • 55 rue de Bonneuil-Matours • 86000 Poitiers
>
>
> Le mer. 8 juin 2022 à 14:40, Thomas WILLIAMSON <
> t-williamson@eauxdevienne.fr> a écrit :
>
>> Hello,
>>
>> Thank you for such a quick response! Modifying this option in file
>> /etc/apache2/default-server.conf within <Directory "/var/www"> returns a
>> prohibited access (403 error) page:
>>
>> [image: image.png]
>>
>>
>> --
>>
>>
>> Thomas WILLIAMSON • Technicien Systèmes et réseaux
>>
>> *Tél.* 05 49 61 25 25 (*interne *: 2235)
>>
>> *Eaux de Vienne - Siveer* • 55 rue de Bonneuil-Matours • 86000 Poitiers
>>
>>
>> Le mer. 8 juin 2022 à 14:19, Yehuda Katz <ye...@ymkatz.net> a écrit :
>>
>>> You have "AllowOverride None" in your "<Directory "/var/www">". This
>>> means your .htaccess file and therefore your mod_rewrite configuration is
>>> not being read. The simplest option is "AllowOverride All" (you can specify
>>> specific overrides too if you want).
>>>
>>> - Y
>>>
>>> Sent from a device with a very small keyboard and hyperactive
>>> autocorrect.
>>>
>>> On Wed, Jun 8, 2022, 8:12 AM Thomas WILLIAMSON <
>>> t-williamson@eauxdevienne.fr> wrote:
>>>
>>>> Hello,
>>>>
>>>> I have to take over an internal Web server that has been configured by
>>>> a colleague who is no longer there. Our developers team asks me to convert
>>>> applications URLs from an *Alias* to a *Virtualhosts* (subdomain
>>>> naming) system. For instance:
>>>>
>>>> https://srv-intra.mydomain.fr/basecolldev
>>>>
>>>>
>>>> should become
>>>>
>>>> https://basecolldev.mydomain.fr
>>>>
>>>>
>>>> My environment specifications:
>>>>
>>>>    - Linux OpenSUSE Leap 15.3
>>>>    - Server version: Apache/2.4.51 (Linux/SUSE)
>>>>    - PHP 7.4.6 (cli) ( NTS )
>>>>
>>>> *Issue description: *I can connect to https://basecolldev.mydomain.fr
>>>> despite some 404 errors showing in access_log file (see at the end of the
>>>> post). I have then a 404 error page when clicking the *login* button
>>>> that redirects to https://basecolldev.mydomain.fr/login. The login
>>>> page is found and displayed properly when I manually modify the URL to
>>>> https://basecolldev.mydomain.fr/index.php/login. This means that
>>>> /index.php is not required for home page connection but is for
>>>> browsing the website. I need to permanently prevent the /index.php
>>>> suffix to show up in URL.
>>>>
>>>> I describe below what I have configured so far and what remains
>>>> unfunctionnal.
>>>>
>>>> I have first created a new vhost file
>>>> /etc/apache2/vhost.d/basecolldev-ssl.conf :
>>>>
>>>> <VirtualHost basecolldev.mydomain.fr:443>
>>>>
>>>>
>>>>>     DocumentRoot "/var/www/BaseCollDev/public"
>>>>>     ServerName basecolldev.mydomain.fr
>>>>>     ErrorLog /var/log/apache2/basecolldev-error_log
>>>>>     TransferLog /var/log/apache2/basecolldev-access_log
>>>>>     LogLevel alert rewrite:trace8
>>>>
>>>>
>>>>>     <Directory /var/www/BaseCollDev/public>
>>>>>          #Order allow,deny
>>>>>          #allow from all
>>>>>          #AllowOverride All
>>>>>          Require all granted
>>>>>          Options -Indexes -Includes -ExecCGI -FollowSymlinks
>>>>>     </Directory>
>>>>
>>>>
>>>>> </VirtualHost>
>>>>
>>>>
>>>> I have then commented the lines related to the application Directory
>>>> tag in file /etc/apache2/default-server.conf :
>>>>
>>>> DocumentRoot "/var/www"
>>>>
>>>>
>>>>> <Directory "/var/www">
>>>>>     Options FollowSymLinks
>>>>>     AllowOverride None
>>>>>     <IfModule !mod_access_compat.c>
>>>>>             Require all granted
>>>>>     </IfModule>
>>>>>     <IfModule mod_access_compat.c>
>>>>>         Order allow,deny
>>>>>         Allow from all
>>>>>     </IfModule>
>>>>> </Directory>
>>>>
>>>>
>>>>> Alias /icons/ "/usr/share/apache2/icons/"
>>>>> Alias /phpmyadmin "/srv/www/htdocs/phpMyAdmin"
>>>>
>>>>
>>>>> <Directory "/usr/share/apache2/icons">
>>>>>     Options Indexes MultiViews
>>>>>     AllowOverride None
>>>>>     <IfModule !mod_access_compat.c>
>>>>>         Require all granted
>>>>>     </IfModule>
>>>>>     <IfModule mod_access_compat.c>
>>>>>         Order allow,deny
>>>>>         Allow from all
>>>>>     </IfModule>
>>>>> </Directory>
>>>>
>>>>
>>>>>
>>>>> #<Directory "/var/www/BaseCollDev/public">
>>>>> #        AllowOverride All
>>>>> #        Require all granted
>>>>> #</Directory>
>>>>
>>>>
>>>>> ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"
>>>>
>>>>
>>>>> <Directory "/srv/www/cgi-bin">
>>>>>     AllowOverride None
>>>>>     Options +ExecCGI -Includes
>>>>>     <IfModule !mod_access_compat.c>
>>>>>         Require all granted
>>>>>     </IfModule>
>>>>>     <IfModule mod_access_compat.c>
>>>>>         Order allow,deny
>>>>>         Allow from all
>>>>>     </IfModule>
>>>>> </Directory>
>>>>
>>>>
>>>>> <IfModule mod_userdir.c>
>>>>>     UserDir public_html
>>>>>     Include /etc/apache2/mod_userdir.conf
>>>>> </IfModule>
>>>>
>>>>
>>>>> IncludeOptional /etc/apache2/conf.d/*.conf
>>>>
>>>>
>>>>> IncludeOptional /etc/apache2/conf.d/apache2-manual?conf
>>>>
>>>>
>>>> ----
>>>>
>>>> Extract from /var/log/apache2/basecolldev-access_log file relating to
>>>> a connection to the home page:
>>>>
>>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET / HTTP/1.1" 200 54206
>>>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
>>>>> /build/runtime.d94b3b43.js HTTP/1.1" 200 1505
>>>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
>>>>> /build/app.13d64c6c.js HTTP/1.1" 200 236
>>>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/2.9935185b.css
>>>>> HTTP/1.1" 200 64639
>>>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
>>>>> /build/app.6cefaab5.css HTTP/1.1" 200 163752
>>>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/2.28b18d57.js
>>>>> HTTP/1.1" 200 261268
>>>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
>>>>> /build/images/logoEdVBlanc.png HTTP/1.1" 200 6579
>>>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /_wdt/b07606
>>>>> HTTP/1.1" 404 1280
>>>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
>>>>> /build/fonts/fa-solid-900.e8a427e1.woff2 HTTP/1.1" 200 78196
>>>>> 10.9.4.140 - - [03/Jun/2022:11:02:32 +0200] "GET /favicon.ico
>>>>> HTTP/1.1" 404 1280
>>>>> 10.9.4.140 - - [03/Jun/2022:11:02:32 +0200] "GET /_wdt/b07606
>>>>> HTTP/1.1" 404 1280
>>>>> 10.9.4.140 - - [03/Jun/2022:11:02:33 +0200] "GET /_wdt/b07606
>>>>> HTTP/1.1" 404 1280
>>>>> 10.9.4.140 - - [03/Jun/2022:11:02:34 +0200] "GET /_wdt/b07606
>>>>> HTTP/1.1" 404 1280
>>>>> 10.9.4.140 - - [03/Jun/2022:11:02:35 +0200] "GET /_wdt/b07606
>>>>> HTTP/1.1" 404 1280
>>>>
>>>>
>>>> Extract from /var/log/apache2/basecolldev-access_log file relating to
>>>> a connection to the login page:
>>>>
>>>> 10.9.4.140 - - [03/Jun/2022:11:03:47 +0200] "GET /login HTTP/1.1" 404
>>>>> 1280
>>>>
>>>>
>>>> I see no logs in /var/log/apache2/basecolldev-error_log file.
>>>>
>>>> I enclose .htaccess files contents if necessary.
>>>>
>>>> File /var/www/.htaccess :
>>>>
>>>> # BEGIN WordPress
>>>>> <IfModule mod_rewrite.c>
>>>>>     RewriteEngine On
>>>>>     RewriteBase /
>>>>>     RewriteRule ^index\.php$ - [L]
>>>>>     RewriteCond %{REQUEST_FILENAME} !-f
>>>>>     RewriteCond %{REQUEST_FILENAME} !-d
>>>>>     RewriteRule . /index.php [L]
>>>>> </IfModule>
>>>>> # END WordPress
>>>>
>>>>
>>>> File /var/www/BaseCollDev/public/.htaccess :
>>>>
>>>> DirectoryIndex index.php
>>>>
>>>>
>>>>> <IfModule mod_negotiation.c>
>>>>>  Options -MultiViews
>>>>> </IfModule>
>>>>
>>>>
>>>>> <IfModule mod_rewrite.c>
>>>>>     RewriteEngine On
>>>>
>>>>
>>>>>     RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$
>>>>>     RewriteRule .* - [E=BASE:%1]
>>>>
>>>>
>>>>>     RewriteCond %{HTTP:Authorization} .+
>>>>>     RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
>>>>
>>>>
>>>>>     RewriteCond %{ENV:REDIRECT_STATUS} =""
>>>>>     RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
>>>>
>>>>
>>>>>     RewriteCond %{REQUEST_FILENAME} !-f
>>>>>     RewriteRule ^ %{ENV:BASE}/index.php [L]
>>>>>  </IfModule>
>>>>
>>>>
>>>>>  <IfModule !mod_rewrite.c>
>>>>>      <IfModule mod_alias.c>
>>>>>         RedirectMatch 307 ^/$ /index.php/
>>>>>      </IfModule>
>>>>>  </IfModule>
>>>>
>>>>
>>>>
>>>> Please note this case has been described here
>>>> <https://stackoverflow.com/questions/72487821/apache-website-conversion-from-alias-to-virtualhost>
>>>> but has not received any help so far.
>>>>
>>>>
>>>> --
>>>>
>>>>
>>>> Thomas WILLIAMSON • Technicien Systèmes et réseaux
>>>>
>>>> *Tél.* 05 49 61 25 25 (*interne *: 2235)
>>>>
>>>> *Eaux de Vienne - Siveer* • 55 rue de Bonneuil-Matours • 86000 Poitiers
>>>>
>>>

Re: [users@httpd] Apache website conversion from alias to virtualhost

Posted by Thomas WILLIAMSON <t-...@eauxdevienne.fr>.
Error log:

[Wed Jun 08 14:45:32.634334 2022] [rewrite:error] [pid 29729] [client
> 10.9.4.140:55414] AH00670: Options FollowSymLinks and
> SymLinksIfOwnerMatch are both off, so the RewriteRule directive is also
> forbidden due to its similar ability to circumvent directory restrictions :
> /var/www/BaseCollDev/public/


Any idea?

Thomas


--


Thomas WILLIAMSON • Technicien Systèmes et réseaux

*Tél.* 05 49 61 25 25 (*interne *: 2235)

*Eaux de Vienne - Siveer* • 55 rue de Bonneuil-Matours • 86000 Poitiers


Le mer. 8 juin 2022 à 14:40, Thomas WILLIAMSON <t-...@eauxdevienne.fr>
a écrit :

> Hello,
>
> Thank you for such a quick response! Modifying this option in file
> /etc/apache2/default-server.conf within <Directory "/var/www"> returns a
> prohibited access (403 error) page:
>
> [image: image.png]
>
>
> --
>
>
> Thomas WILLIAMSON • Technicien Systèmes et réseaux
>
> *Tél.* 05 49 61 25 25 (*interne *: 2235)
>
> *Eaux de Vienne - Siveer* • 55 rue de Bonneuil-Matours • 86000 Poitiers
>
>
> Le mer. 8 juin 2022 à 14:19, Yehuda Katz <ye...@ymkatz.net> a écrit :
>
>> You have "AllowOverride None" in your "<Directory "/var/www">". This
>> means your .htaccess file and therefore your mod_rewrite configuration is
>> not being read. The simplest option is "AllowOverride All" (you can specify
>> specific overrides too if you want).
>>
>> - Y
>>
>> Sent from a device with a very small keyboard and hyperactive autocorrect.
>>
>> On Wed, Jun 8, 2022, 8:12 AM Thomas WILLIAMSON <
>> t-williamson@eauxdevienne.fr> wrote:
>>
>>> Hello,
>>>
>>> I have to take over an internal Web server that has been configured by a
>>> colleague who is no longer there. Our developers team asks me to convert
>>> applications URLs from an *Alias* to a *Virtualhosts* (subdomain
>>> naming) system. For instance:
>>>
>>> https://srv-intra.mydomain.fr/basecolldev
>>>
>>>
>>> should become
>>>
>>> https://basecolldev.mydomain.fr
>>>
>>>
>>> My environment specifications:
>>>
>>>    - Linux OpenSUSE Leap 15.3
>>>    - Server version: Apache/2.4.51 (Linux/SUSE)
>>>    - PHP 7.4.6 (cli) ( NTS )
>>>
>>> *Issue description: *I can connect to https://basecolldev.mydomain.fr
>>> despite some 404 errors showing in access_log file (see at the end of the
>>> post). I have then a 404 error page when clicking the *login* button
>>> that redirects to https://basecolldev.mydomain.fr/login. The login page
>>> is found and displayed properly when I manually modify the URL to
>>> https://basecolldev.mydomain.fr/index.php/login. This means that
>>> /index.php is not required for home page connection but is for browsing
>>> the website. I need to permanently prevent the /index.php suffix to
>>> show up in URL.
>>>
>>> I describe below what I have configured so far and what remains
>>> unfunctionnal.
>>>
>>> I have first created a new vhost file
>>> /etc/apache2/vhost.d/basecolldev-ssl.conf :
>>>
>>> <VirtualHost basecolldev.mydomain.fr:443>
>>>
>>>
>>>>     DocumentRoot "/var/www/BaseCollDev/public"
>>>>     ServerName basecolldev.mydomain.fr
>>>>     ErrorLog /var/log/apache2/basecolldev-error_log
>>>>     TransferLog /var/log/apache2/basecolldev-access_log
>>>>     LogLevel alert rewrite:trace8
>>>
>>>
>>>>     <Directory /var/www/BaseCollDev/public>
>>>>          #Order allow,deny
>>>>          #allow from all
>>>>          #AllowOverride All
>>>>          Require all granted
>>>>          Options -Indexes -Includes -ExecCGI -FollowSymlinks
>>>>     </Directory>
>>>
>>>
>>>> </VirtualHost>
>>>
>>>
>>> I have then commented the lines related to the application Directory tag
>>> in file /etc/apache2/default-server.conf :
>>>
>>> DocumentRoot "/var/www"
>>>
>>>
>>>> <Directory "/var/www">
>>>>     Options FollowSymLinks
>>>>     AllowOverride None
>>>>     <IfModule !mod_access_compat.c>
>>>>             Require all granted
>>>>     </IfModule>
>>>>     <IfModule mod_access_compat.c>
>>>>         Order allow,deny
>>>>         Allow from all
>>>>     </IfModule>
>>>> </Directory>
>>>
>>>
>>>> Alias /icons/ "/usr/share/apache2/icons/"
>>>> Alias /phpmyadmin "/srv/www/htdocs/phpMyAdmin"
>>>
>>>
>>>> <Directory "/usr/share/apache2/icons">
>>>>     Options Indexes MultiViews
>>>>     AllowOverride None
>>>>     <IfModule !mod_access_compat.c>
>>>>         Require all granted
>>>>     </IfModule>
>>>>     <IfModule mod_access_compat.c>
>>>>         Order allow,deny
>>>>         Allow from all
>>>>     </IfModule>
>>>> </Directory>
>>>
>>>
>>>>
>>>> #<Directory "/var/www/BaseCollDev/public">
>>>> #        AllowOverride All
>>>> #        Require all granted
>>>> #</Directory>
>>>
>>>
>>>> ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"
>>>
>>>
>>>> <Directory "/srv/www/cgi-bin">
>>>>     AllowOverride None
>>>>     Options +ExecCGI -Includes
>>>>     <IfModule !mod_access_compat.c>
>>>>         Require all granted
>>>>     </IfModule>
>>>>     <IfModule mod_access_compat.c>
>>>>         Order allow,deny
>>>>         Allow from all
>>>>     </IfModule>
>>>> </Directory>
>>>
>>>
>>>> <IfModule mod_userdir.c>
>>>>     UserDir public_html
>>>>     Include /etc/apache2/mod_userdir.conf
>>>> </IfModule>
>>>
>>>
>>>> IncludeOptional /etc/apache2/conf.d/*.conf
>>>
>>>
>>>> IncludeOptional /etc/apache2/conf.d/apache2-manual?conf
>>>
>>>
>>> ----
>>>
>>> Extract from /var/log/apache2/basecolldev-access_log file relating to a
>>> connection to the home page:
>>>
>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET / HTTP/1.1" 200 54206
>>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
>>>> /build/runtime.d94b3b43.js HTTP/1.1" 200 1505
>>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/app.13d64c6c.js
>>>> HTTP/1.1" 200 236
>>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/2.9935185b.css
>>>> HTTP/1.1" 200 64639
>>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
>>>> /build/app.6cefaab5.css HTTP/1.1" 200 163752
>>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/2.28b18d57.js
>>>> HTTP/1.1" 200 261268
>>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
>>>> /build/images/logoEdVBlanc.png HTTP/1.1" 200 6579
>>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /_wdt/b07606 HTTP/1.1"
>>>> 404 1280
>>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
>>>> /build/fonts/fa-solid-900.e8a427e1.woff2 HTTP/1.1" 200 78196
>>>> 10.9.4.140 - - [03/Jun/2022:11:02:32 +0200] "GET /favicon.ico HTTP/1.1"
>>>> 404 1280
>>>> 10.9.4.140 - - [03/Jun/2022:11:02:32 +0200] "GET /_wdt/b07606 HTTP/1.1"
>>>> 404 1280
>>>> 10.9.4.140 - - [03/Jun/2022:11:02:33 +0200] "GET /_wdt/b07606 HTTP/1.1"
>>>> 404 1280
>>>> 10.9.4.140 - - [03/Jun/2022:11:02:34 +0200] "GET /_wdt/b07606 HTTP/1.1"
>>>> 404 1280
>>>> 10.9.4.140 - - [03/Jun/2022:11:02:35 +0200] "GET /_wdt/b07606 HTTP/1.1"
>>>> 404 1280
>>>
>>>
>>> Extract from /var/log/apache2/basecolldev-access_log file relating to a
>>> connection to the login page:
>>>
>>> 10.9.4.140 - - [03/Jun/2022:11:03:47 +0200] "GET /login HTTP/1.1" 404
>>>> 1280
>>>
>>>
>>> I see no logs in /var/log/apache2/basecolldev-error_log file.
>>>
>>> I enclose .htaccess files contents if necessary.
>>>
>>> File /var/www/.htaccess :
>>>
>>> # BEGIN WordPress
>>>> <IfModule mod_rewrite.c>
>>>>     RewriteEngine On
>>>>     RewriteBase /
>>>>     RewriteRule ^index\.php$ - [L]
>>>>     RewriteCond %{REQUEST_FILENAME} !-f
>>>>     RewriteCond %{REQUEST_FILENAME} !-d
>>>>     RewriteRule . /index.php [L]
>>>> </IfModule>
>>>> # END WordPress
>>>
>>>
>>> File /var/www/BaseCollDev/public/.htaccess :
>>>
>>> DirectoryIndex index.php
>>>
>>>
>>>> <IfModule mod_negotiation.c>
>>>>  Options -MultiViews
>>>> </IfModule>
>>>
>>>
>>>> <IfModule mod_rewrite.c>
>>>>     RewriteEngine On
>>>
>>>
>>>>     RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$
>>>>     RewriteRule .* - [E=BASE:%1]
>>>
>>>
>>>>     RewriteCond %{HTTP:Authorization} .+
>>>>     RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
>>>
>>>
>>>>     RewriteCond %{ENV:REDIRECT_STATUS} =""
>>>>     RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
>>>
>>>
>>>>     RewriteCond %{REQUEST_FILENAME} !-f
>>>>     RewriteRule ^ %{ENV:BASE}/index.php [L]
>>>>  </IfModule>
>>>
>>>
>>>>  <IfModule !mod_rewrite.c>
>>>>      <IfModule mod_alias.c>
>>>>         RedirectMatch 307 ^/$ /index.php/
>>>>      </IfModule>
>>>>  </IfModule>
>>>
>>>
>>>
>>> Please note this case has been described here
>>> <https://stackoverflow.com/questions/72487821/apache-website-conversion-from-alias-to-virtualhost>
>>> but has not received any help so far.
>>>
>>>
>>> --
>>>
>>>
>>> Thomas WILLIAMSON • Technicien Systèmes et réseaux
>>>
>>> *Tél.* 05 49 61 25 25 (*interne *: 2235)
>>>
>>> *Eaux de Vienne - Siveer* • 55 rue de Bonneuil-Matours • 86000 Poitiers
>>>
>>

Re: [users@httpd] Apache website conversion from alias to virtualhost

Posted by Thomas WILLIAMSON <t-...@eauxdevienne.fr>.
Hello,

Thank you for such a quick response! Modifying this option in file
/etc/apache2/default-server.conf within <Directory "/var/www"> returns a
prohibited access (403 error) page:

[image: image.png]


--


Thomas WILLIAMSON • Technicien Systèmes et réseaux

*Tél.* 05 49 61 25 25 (*interne *: 2235)

*Eaux de Vienne - Siveer* • 55 rue de Bonneuil-Matours • 86000 Poitiers


Le mer. 8 juin 2022 à 14:19, Yehuda Katz <ye...@ymkatz.net> a écrit :

> You have "AllowOverride None" in your "<Directory "/var/www">". This means
> your .htaccess file and therefore your mod_rewrite configuration is not
> being read. The simplest option is "AllowOverride All" (you can specify
> specific overrides too if you want).
>
> - Y
>
> Sent from a device with a very small keyboard and hyperactive autocorrect.
>
> On Wed, Jun 8, 2022, 8:12 AM Thomas WILLIAMSON <
> t-williamson@eauxdevienne.fr> wrote:
>
>> Hello,
>>
>> I have to take over an internal Web server that has been configured by a
>> colleague who is no longer there. Our developers team asks me to convert
>> applications URLs from an *Alias* to a *Virtualhosts* (subdomain naming)
>> system. For instance:
>>
>> https://srv-intra.mydomain.fr/basecolldev
>>
>>
>> should become
>>
>> https://basecolldev.mydomain.fr
>>
>>
>> My environment specifications:
>>
>>    - Linux OpenSUSE Leap 15.3
>>    - Server version: Apache/2.4.51 (Linux/SUSE)
>>    - PHP 7.4.6 (cli) ( NTS )
>>
>> *Issue description: *I can connect to https://basecolldev.mydomain.fr
>> despite some 404 errors showing in access_log file (see at the end of the
>> post). I have then a 404 error page when clicking the *login* button
>> that redirects to https://basecolldev.mydomain.fr/login. The login page
>> is found and displayed properly when I manually modify the URL to
>> https://basecolldev.mydomain.fr/index.php/login. This means that
>> /index.php is not required for home page connection but is for browsing
>> the website. I need to permanently prevent the /index.php suffix to show
>> up in URL.
>>
>> I describe below what I have configured so far and what remains
>> unfunctionnal.
>>
>> I have first created a new vhost file
>> /etc/apache2/vhost.d/basecolldev-ssl.conf :
>>
>> <VirtualHost basecolldev.mydomain.fr:443>
>>
>>
>>>     DocumentRoot "/var/www/BaseCollDev/public"
>>>     ServerName basecolldev.mydomain.fr
>>>     ErrorLog /var/log/apache2/basecolldev-error_log
>>>     TransferLog /var/log/apache2/basecolldev-access_log
>>>     LogLevel alert rewrite:trace8
>>
>>
>>>     <Directory /var/www/BaseCollDev/public>
>>>          #Order allow,deny
>>>          #allow from all
>>>          #AllowOverride All
>>>          Require all granted
>>>          Options -Indexes -Includes -ExecCGI -FollowSymlinks
>>>     </Directory>
>>
>>
>>> </VirtualHost>
>>
>>
>> I have then commented the lines related to the application Directory tag
>> in file /etc/apache2/default-server.conf :
>>
>> DocumentRoot "/var/www"
>>
>>
>>> <Directory "/var/www">
>>>     Options FollowSymLinks
>>>     AllowOverride None
>>>     <IfModule !mod_access_compat.c>
>>>             Require all granted
>>>     </IfModule>
>>>     <IfModule mod_access_compat.c>
>>>         Order allow,deny
>>>         Allow from all
>>>     </IfModule>
>>> </Directory>
>>
>>
>>> Alias /icons/ "/usr/share/apache2/icons/"
>>> Alias /phpmyadmin "/srv/www/htdocs/phpMyAdmin"
>>
>>
>>> <Directory "/usr/share/apache2/icons">
>>>     Options Indexes MultiViews
>>>     AllowOverride None
>>>     <IfModule !mod_access_compat.c>
>>>         Require all granted
>>>     </IfModule>
>>>     <IfModule mod_access_compat.c>
>>>         Order allow,deny
>>>         Allow from all
>>>     </IfModule>
>>> </Directory>
>>
>>
>>>
>>> #<Directory "/var/www/BaseCollDev/public">
>>> #        AllowOverride All
>>> #        Require all granted
>>> #</Directory>
>>
>>
>>> ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"
>>
>>
>>> <Directory "/srv/www/cgi-bin">
>>>     AllowOverride None
>>>     Options +ExecCGI -Includes
>>>     <IfModule !mod_access_compat.c>
>>>         Require all granted
>>>     </IfModule>
>>>     <IfModule mod_access_compat.c>
>>>         Order allow,deny
>>>         Allow from all
>>>     </IfModule>
>>> </Directory>
>>
>>
>>> <IfModule mod_userdir.c>
>>>     UserDir public_html
>>>     Include /etc/apache2/mod_userdir.conf
>>> </IfModule>
>>
>>
>>> IncludeOptional /etc/apache2/conf.d/*.conf
>>
>>
>>> IncludeOptional /etc/apache2/conf.d/apache2-manual?conf
>>
>>
>> ----
>>
>> Extract from /var/log/apache2/basecolldev-access_log file relating to a
>> connection to the home page:
>>
>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET / HTTP/1.1" 200 54206
>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
>>> /build/runtime.d94b3b43.js HTTP/1.1" 200 1505
>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/app.13d64c6c.js
>>> HTTP/1.1" 200 236
>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/2.9935185b.css
>>> HTTP/1.1" 200 64639
>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/app.6cefaab5.css
>>> HTTP/1.1" 200 163752
>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/2.28b18d57.js
>>> HTTP/1.1" 200 261268
>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
>>> /build/images/logoEdVBlanc.png HTTP/1.1" 200 6579
>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /_wdt/b07606 HTTP/1.1"
>>> 404 1280
>>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
>>> /build/fonts/fa-solid-900.e8a427e1.woff2 HTTP/1.1" 200 78196
>>> 10.9.4.140 - - [03/Jun/2022:11:02:32 +0200] "GET /favicon.ico HTTP/1.1"
>>> 404 1280
>>> 10.9.4.140 - - [03/Jun/2022:11:02:32 +0200] "GET /_wdt/b07606 HTTP/1.1"
>>> 404 1280
>>> 10.9.4.140 - - [03/Jun/2022:11:02:33 +0200] "GET /_wdt/b07606 HTTP/1.1"
>>> 404 1280
>>> 10.9.4.140 - - [03/Jun/2022:11:02:34 +0200] "GET /_wdt/b07606 HTTP/1.1"
>>> 404 1280
>>> 10.9.4.140 - - [03/Jun/2022:11:02:35 +0200] "GET /_wdt/b07606 HTTP/1.1"
>>> 404 1280
>>
>>
>> Extract from /var/log/apache2/basecolldev-access_log file relating to a
>> connection to the login page:
>>
>> 10.9.4.140 - - [03/Jun/2022:11:03:47 +0200] "GET /login HTTP/1.1" 404 1280
>>
>>
>> I see no logs in /var/log/apache2/basecolldev-error_log file.
>>
>> I enclose .htaccess files contents if necessary.
>>
>> File /var/www/.htaccess :
>>
>> # BEGIN WordPress
>>> <IfModule mod_rewrite.c>
>>>     RewriteEngine On
>>>     RewriteBase /
>>>     RewriteRule ^index\.php$ - [L]
>>>     RewriteCond %{REQUEST_FILENAME} !-f
>>>     RewriteCond %{REQUEST_FILENAME} !-d
>>>     RewriteRule . /index.php [L]
>>> </IfModule>
>>> # END WordPress
>>
>>
>> File /var/www/BaseCollDev/public/.htaccess :
>>
>> DirectoryIndex index.php
>>
>>
>>> <IfModule mod_negotiation.c>
>>>  Options -MultiViews
>>> </IfModule>
>>
>>
>>> <IfModule mod_rewrite.c>
>>>     RewriteEngine On
>>
>>
>>>     RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$
>>>     RewriteRule .* - [E=BASE:%1]
>>
>>
>>>     RewriteCond %{HTTP:Authorization} .+
>>>     RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
>>
>>
>>>     RewriteCond %{ENV:REDIRECT_STATUS} =""
>>>     RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
>>
>>
>>>     RewriteCond %{REQUEST_FILENAME} !-f
>>>     RewriteRule ^ %{ENV:BASE}/index.php [L]
>>>  </IfModule>
>>
>>
>>>  <IfModule !mod_rewrite.c>
>>>      <IfModule mod_alias.c>
>>>         RedirectMatch 307 ^/$ /index.php/
>>>      </IfModule>
>>>  </IfModule>
>>
>>
>>
>> Please note this case has been described here
>> <https://stackoverflow.com/questions/72487821/apache-website-conversion-from-alias-to-virtualhost>
>> but has not received any help so far.
>>
>>
>> --
>>
>>
>> Thomas WILLIAMSON • Technicien Systèmes et réseaux
>>
>> *Tél.* 05 49 61 25 25 (*interne *: 2235)
>>
>> *Eaux de Vienne - Siveer* • 55 rue de Bonneuil-Matours • 86000 Poitiers
>>
>

Re: [users@httpd] Apache website conversion from alias to virtualhost

Posted by Yehuda Katz <ye...@ymkatz.net>.
You have "AllowOverride None" in your "<Directory "/var/www">". This means
your .htaccess file and therefore your mod_rewrite configuration is not
being read. The simplest option is "AllowOverride All" (you can specify
specific overrides too if you want).

- Y

Sent from a device with a very small keyboard and hyperactive autocorrect.

On Wed, Jun 8, 2022, 8:12 AM Thomas WILLIAMSON <t-...@eauxdevienne.fr>
wrote:

> Hello,
>
> I have to take over an internal Web server that has been configured by a
> colleague who is no longer there. Our developers team asks me to convert
> applications URLs from an *Alias* to a *Virtualhosts* (subdomain naming)
> system. For instance:
>
> https://srv-intra.mydomain.fr/basecolldev
>
>
> should become
>
> https://basecolldev.mydomain.fr
>
>
> My environment specifications:
>
>    - Linux OpenSUSE Leap 15.3
>    - Server version: Apache/2.4.51 (Linux/SUSE)
>    - PHP 7.4.6 (cli) ( NTS )
>
> *Issue description: *I can connect to https://basecolldev.mydomain.fr
> despite some 404 errors showing in access_log file (see at the end of the
> post). I have then a 404 error page when clicking the *login* button that
> redirects to https://basecolldev.mydomain.fr/login. The login page is
> found and displayed properly when I manually modify the URL to
> https://basecolldev.mydomain.fr/index.php/login. This means that
> /index.php is not required for home page connection but is for browsing
> the website. I need to permanently prevent the /index.php suffix to show
> up in URL.
>
> I describe below what I have configured so far and what remains
> unfunctionnal.
>
> I have first created a new vhost file
> /etc/apache2/vhost.d/basecolldev-ssl.conf :
>
> <VirtualHost basecolldev.mydomain.fr:443>
>
>
>>     DocumentRoot "/var/www/BaseCollDev/public"
>>     ServerName basecolldev.mydomain.fr
>>     ErrorLog /var/log/apache2/basecolldev-error_log
>>     TransferLog /var/log/apache2/basecolldev-access_log
>>     LogLevel alert rewrite:trace8
>
>
>>     <Directory /var/www/BaseCollDev/public>
>>          #Order allow,deny
>>          #allow from all
>>          #AllowOverride All
>>          Require all granted
>>          Options -Indexes -Includes -ExecCGI -FollowSymlinks
>>     </Directory>
>
>
>> </VirtualHost>
>
>
> I have then commented the lines related to the application Directory tag
> in file /etc/apache2/default-server.conf :
>
> DocumentRoot "/var/www"
>
>
>> <Directory "/var/www">
>>     Options FollowSymLinks
>>     AllowOverride None
>>     <IfModule !mod_access_compat.c>
>>             Require all granted
>>     </IfModule>
>>     <IfModule mod_access_compat.c>
>>         Order allow,deny
>>         Allow from all
>>     </IfModule>
>> </Directory>
>
>
>> Alias /icons/ "/usr/share/apache2/icons/"
>> Alias /phpmyadmin "/srv/www/htdocs/phpMyAdmin"
>
>
>> <Directory "/usr/share/apache2/icons">
>>     Options Indexes MultiViews
>>     AllowOverride None
>>     <IfModule !mod_access_compat.c>
>>         Require all granted
>>     </IfModule>
>>     <IfModule mod_access_compat.c>
>>         Order allow,deny
>>         Allow from all
>>     </IfModule>
>> </Directory>
>
>
>>
>> #<Directory "/var/www/BaseCollDev/public">
>> #        AllowOverride All
>> #        Require all granted
>> #</Directory>
>
>
>> ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"
>
>
>> <Directory "/srv/www/cgi-bin">
>>     AllowOverride None
>>     Options +ExecCGI -Includes
>>     <IfModule !mod_access_compat.c>
>>         Require all granted
>>     </IfModule>
>>     <IfModule mod_access_compat.c>
>>         Order allow,deny
>>         Allow from all
>>     </IfModule>
>> </Directory>
>
>
>> <IfModule mod_userdir.c>
>>     UserDir public_html
>>     Include /etc/apache2/mod_userdir.conf
>> </IfModule>
>
>
>> IncludeOptional /etc/apache2/conf.d/*.conf
>
>
>> IncludeOptional /etc/apache2/conf.d/apache2-manual?conf
>
>
> ----
>
> Extract from /var/log/apache2/basecolldev-access_log file relating to a
> connection to the home page:
>
> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET / HTTP/1.1" 200 54206
>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
>> /build/runtime.d94b3b43.js HTTP/1.1" 200 1505
>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/app.13d64c6c.js
>> HTTP/1.1" 200 236
>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/2.9935185b.css
>> HTTP/1.1" 200 64639
>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/app.6cefaab5.css
>> HTTP/1.1" 200 163752
>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /build/2.28b18d57.js
>> HTTP/1.1" 200 261268
>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
>> /build/images/logoEdVBlanc.png HTTP/1.1" 200 6579
>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET /_wdt/b07606 HTTP/1.1"
>> 404 1280
>> 10.9.4.140 - - [03/Jun/2022:11:02:31 +0200] "GET
>> /build/fonts/fa-solid-900.e8a427e1.woff2 HTTP/1.1" 200 78196
>> 10.9.4.140 - - [03/Jun/2022:11:02:32 +0200] "GET /favicon.ico HTTP/1.1"
>> 404 1280
>> 10.9.4.140 - - [03/Jun/2022:11:02:32 +0200] "GET /_wdt/b07606 HTTP/1.1"
>> 404 1280
>> 10.9.4.140 - - [03/Jun/2022:11:02:33 +0200] "GET /_wdt/b07606 HTTP/1.1"
>> 404 1280
>> 10.9.4.140 - - [03/Jun/2022:11:02:34 +0200] "GET /_wdt/b07606 HTTP/1.1"
>> 404 1280
>> 10.9.4.140 - - [03/Jun/2022:11:02:35 +0200] "GET /_wdt/b07606 HTTP/1.1"
>> 404 1280
>
>
> Extract from /var/log/apache2/basecolldev-access_log file relating to a
> connection to the login page:
>
> 10.9.4.140 - - [03/Jun/2022:11:03:47 +0200] "GET /login HTTP/1.1" 404 1280
>
>
> I see no logs in /var/log/apache2/basecolldev-error_log file.
>
> I enclose .htaccess files contents if necessary.
>
> File /var/www/.htaccess :
>
> # BEGIN WordPress
>> <IfModule mod_rewrite.c>
>>     RewriteEngine On
>>     RewriteBase /
>>     RewriteRule ^index\.php$ - [L]
>>     RewriteCond %{REQUEST_FILENAME} !-f
>>     RewriteCond %{REQUEST_FILENAME} !-d
>>     RewriteRule . /index.php [L]
>> </IfModule>
>> # END WordPress
>
>
> File /var/www/BaseCollDev/public/.htaccess :
>
> DirectoryIndex index.php
>
>
>> <IfModule mod_negotiation.c>
>>  Options -MultiViews
>> </IfModule>
>
>
>> <IfModule mod_rewrite.c>
>>     RewriteEngine On
>
>
>>     RewriteCond %{REQUEST_URI}::$0 ^(/.+)/(.*)::\2$
>>     RewriteRule .* - [E=BASE:%1]
>
>
>>     RewriteCond %{HTTP:Authorization} .+
>>     RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
>
>
>>     RewriteCond %{ENV:REDIRECT_STATUS} =""
>>     RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
>
>
>>     RewriteCond %{REQUEST_FILENAME} !-f
>>     RewriteRule ^ %{ENV:BASE}/index.php [L]
>>  </IfModule>
>
>
>>  <IfModule !mod_rewrite.c>
>>      <IfModule mod_alias.c>
>>         RedirectMatch 307 ^/$ /index.php/
>>      </IfModule>
>>  </IfModule>
>
>
>
> Please note this case has been described here
> <https://stackoverflow.com/questions/72487821/apache-website-conversion-from-alias-to-virtualhost>
> but has not received any help so far.
>
>
> --
>
>
> Thomas WILLIAMSON • Technicien Systèmes et réseaux
>
> *Tél.* 05 49 61 25 25 (*interne *: 2235)
>
> *Eaux de Vienne - Siveer* • 55 rue de Bonneuil-Matours • 86000 Poitiers
>