I had the same issue and couldn't get the apache2 URL Rewrite to work in Ubuntu . The thing that finally fixed it was enabling it in the main apache config, not just the site config.

Steps:
1) sudo nano /etc/apache2/apache2.conf
2) Find

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

3) replace AllowOverride None with AllowOverride All

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

4) Restart apache
sudo systemctl restart apache2

System Specifics:

osTicket Version 	1.17-git (?) — 8fbc7ee is available
Web Server Software 	Apache/2.4.52 (Ubuntu)
MySQL Version 	8.0.32
PHP Version 	8.2.1
2 months later

Hi, I too am getting the error.
However, in my case the directory / file don't actually exist on the server
The plugin is enabled, and has been for some time.

I get this after setting up the Auth:

Should I remove and re-install the Plugin?
Currently running Version 1.17.2
Centos V7, using httpd that ships with Centos

Is it possible I have missed a step somewhere during the Plugin install?

    Androids

    URL Rewriting is not enabled on your webserver. The file doesn't actually exist which is why you need URL Rewriting installed/enabled so that our .htaccess files can rewrite and direct the URL to the proper destination.

    Cheers.

      5 days later

      Thanks, it was already enabled - (/etc/httpd/conf.modules.d/00-base.conf in Centos)
      It is working now regardless.

      Just to add to this;
      [root@tickets /]# httpd -M|grep write
      rewrite_module (shared)

      In (Centos) /etc/httpd/conf/httpd.conf
      <Directory "/var/www/html/osticket"> # YOUR EXACT directory
      AllowOverride All
      Options FollowSymlinks
      Require all granted
      </Directory>

      systemctl restart httpd

      That worked for me - Explicitly defining the osticket directory was the key

      22 days later

      Hi, I've been getting the same error. Before starting with URL rewrite and other suggested fixes, i wanted to know if it is necessary to setup remote mailbox and outgoing. I don't have them setup and i just want to implement simple OAuth with Microsoft login for which i have followed the necessary steps show in the authentication guide for Microsoft in osticket official docs.

      KevinTheJedi

      ramrajone

        10 months later

        Hi, I have the same problem, when I authenticate with office.

        I have apache modrewrite enabled.
        In my virtual host as well as in apache2.conf I have the following

        In the virtual host

        Can you help me

          Rookye23

          I can't say for certain but it's probably due to your virtual site config rules. I would clear all the custom rules, make it default, reload/restart the webserver so the changes are applied, and retest.

          Cheers.

            Hello KevinTheJedi

            This is what I have configured in the plugin

            And I have left the vhost as clean as possible.

            I have modrewrite enabled, which I'm missing

            in my directories I don't have the path to api/auth/oauth2

            I might be configuring the wrong redirect url in Azure ?.

            Thanks

              Rookye23

              No that’s correct. The api/http.php file redirects the request to the proper channels. Definitely seems like a setup issue as you have a custom port but don’t have the site config setup correctly for that.

              Cheers.

              Hello, I have not solved the problem, I want to be able to access osticket through Microsoft365 with the Oauth2 plugin.
              I'm not an expert, I'm forgetting something.
              I leave you the information to see if you can help me.

              When I login through 365 I appear to be logged in, but I am redirected back to the home page and do not enter the agent panel.

              The authentication if it is being done through Microsoft 365

              This is the content of the login errors access.log

              When I log in with a local user it does redirect to the path https://soporte.ticket.com:6971/scp/tickets.php?queue=1&dir=1&sort=10"

              These are the details of my operating system

              Distributor ID: Debian
              Description:    Debian GNU/Linux 10 (buster)
              Release:        10
              Codename:       buster

              Version of osTicket installed

              This is the Azure configuration, but I'm not sure if the Redirect URI configured in Azure is correct.

              Rewrite module is enabled and working

              sudo apache2ctl -M | grep rewrite
               rewrite_module (shared)

              This is the content of the .htaccess directory /var/www/html/osticket/upload/api/.htaccess

              <IfModule mod_rewrite.c>
              
              RewriteEngine On
              
              RewriteCond %{REQUEST_FILENAME} !-f
              RewriteCond %{REQUEST_FILENAME} !-d
              RewriteCond %{REQUEST_URI} (.*/api)
              RewriteRule ^(.*)$ %1/http.php/$1 [L]
              
              </IfModule>

              This is the content of the apache2 configuration directory /etc/apache2/apache2.conf

              <Directory />
                      Options FollowSymLinks
                      AllowOverride All
                      Require all granted
              </Directory>
              
              <Directory /usr/share>
                      AllowOverride None
                      Require all granted
              </Directory>
              
              <Directory /var/www/>
                      Options Indexes FollowSymLinks
                      AllowOverride All
                      Require all granted
              </Directory>

              This is the content of the apache2 port configuration directory /etc/apache2/ports.conf

              Listen 82
              <IfModule ssl_module>
                      Listen 6971
              </IfModule>
              
              <IfModule mod_gnutls.c>
                      Listen 6971
              </IfModule>

              This is the directory contents of the vhost-ssl file directory /etc/apache2/sites-available/osticket-ssl.conf

              <IfModule mod_ssl.c>
                      <VirtualHost *:6971>
                              ServerName soporte.ticket.com:6971
                              ServerAdmin rambo@ticket.com
              
                              DocumentRoot /var/www/html/osticket/upload/
              
                              ErrorLog ${APACHE_LOG_DIR}/error.log
                              CustomLog ${APACHE_LOG_DIR}/access.log combined
              
                              SSLEngine on
                              SSLCertificateFile /etc/ssl/private/soporte.ticket.com.crt
                              SSLCertificateKeyFile /etc/ssl/private/soporte.ticket.com.key
              
                              <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                              SSLOptions +StdEnvVars
                              </FilesMatch>
                              <Directory /usr/lib/cgi-bin>
                                              SSLOptions +StdEnvVars
                              </Directory>
                              <Directory /var/www/html/osticket>
                                      Options FollowSymlinks
                                      AllowOverride All
                                      Require all granted
                              </Directory>
                      </VirtualHost>
              </IfModule>

              This is the directory contents of the vhost file directory /etc/apache2/sites-available/osticket.conf

              <VirtualHost *:82>
                      ServerName soporte.ticket.com:6971
                      ServerAdmin rambo@ticket.com
              
                      DocumentRoot /var/www/html/osticket/upload
                      RewriteEngine On
              
                      ErrorLog ${APACHE_LOG_DIR}/osticket.log
                      CustomLog ${APACHE_LOG_DIR}/osticket_access.log combined
              
                      <Directory /var/www/html/osticket>
                              Options FollowSymlinks
                              AllowOverride All
                              Require all granted
                      </Directory>
              
              </VirtualHost>

              Thank you very much for your help

                Rookye23

                I would need to see your app registration. Also do you have the cURL root certificate installed/enabled for PHP?

                Cheers.

                  Rookye23 When I login through 365 I appear to be logged in, but I am redirected back to the home page and do not enter the agent panel.

                  Are you clicking on the log in as an agent to start the login process?

                    Hello KevinTheJedi curl I have it installed and enabled

                    it's my php.ini

                    in the directory I have the certificate

                    Hello ntozier I log in via 365

                    the agent user I have configured the method 635

                    in the database the agent backend is as follows

                    I meant you should check the url and see if you were in the correct space for an Agent to sign in.
                    Agent area url ends with /scp/login.php
                    User area url ends with /login.php

                    I also noticed from your Apache configs (both p82 and p6971) you have:
                    DocumentRoot /var/www/html/osticket/upload/

                    and both have:
                    <Directory /var/www/html/osticket>
                    Options FollowSymlinks
                    AllowOverride All
                    Require all granted
                    </Directory>

                    /upload/ does not seem to be included for "AllowOverride All"

                      Hello ntozier

                      Ok I understand, for the login with an agent I am in the correct path /scp/login.php

                      I have modified the configuration of the vhost files to include upload as in DocumentRoot

                      But it still doesn't work, when I login with 365 it redirects me to the url https://soporte.ticket.com:6971/

                      <IfModule mod_ssl.c>
                              <VirtualHost *:6971>
                                      ServerName soporte.ticket.com:6971
                                      ServerAdmin rambo@ticket.com
                      
                                      DocumentRoot /var/www/html/osticket/upload/
                      
                                      ErrorLog ${APACHE_LOG_DIR}/error.log
                                      CustomLog ${APACHE_LOG_DIR}/access.log combined
                      
                                      SSLEngine on
                                      SSLCertificateFile /etc/ssl/private/soporte.ticket.com.crt
                                      SSLCertificateKeyFile /etc/ssl/private/soporte.ticket.com.key
                      
                                      <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                                      SSLOptions +StdEnvVars
                                      </FilesMatch>
                                      <Directory /usr/lib/cgi-bin>
                                                      SSLOptions +StdEnvVars
                                      </Directory>
                                      <Directory /var/www/html/osticket/upload>
                                              Options FollowSymlinks
                                              AllowOverride All
                                              Require all granted
                                      </Directory>
                              </VirtualHost>
                      </IfModule>
                      <VirtualHost *:82>
                              ServerName soporte.ticket.com:6971
                              ServerAdmin rambo@ticket.com
                      
                              DocumentRoot /var/www/html/osticket/upload
                              RewriteEngine On
                      
                              ErrorLog ${APACHE_LOG_DIR}/osticket.log
                              CustomLog ${APACHE_LOG_DIR}/osticket_access.log combined
                      
                              <Directory /var/www/html/osticket/upload>
                                      Options FollowSymlinks
                                      AllowOverride All
                                      Require all granted
                              </Directory>
                      
                      </VirtualHost>

                        Rookye23

                        I noticed in your plugin config you have the default "common" endpoints. Are you sure you chose the right endpoints? Go to the app registration, click Overview tab, click Endpoints button, see what the top two endpoints are (should be the only two OAuth2 endpoints), and compare to see if they match your endpoints in the plugin config.

                        Cheers.