url Redirection for customer.pl and index.pl

Moderator: crythias

Locked
Romaing
Znuny newbie
Posts: 60
Joined: 30 Mar 2012, 15:20
Znuny Version: 3.1.5

url Redirection for customer.pl and index.pl

Post by Romaing »

Hello,

Well i've been looking into redirecting the addresses for both agents and customers in the company intranet. As a newbie, since i'm using ubuntu it seems that apache conf is different than on other distribs and with otrs having its own apache config it's all getting a bit confusing to say the least. Which are the right files to alter ?

There seems to all sorts of methods to do that, but for something that looks so easy, it gets frustrating quickly.

All i want is remove the need to type the .index.pl or customer.pl files. and have the agents log on something like otrs/agent and the customer log simply by typing otrs in their adress bar.

I tried this method: viewtopic.php?f=60&t=9329

Apache restarts fine, with no warnings or errors.

And the only result i got is that i don't need to type the ip or hostname anymore, but it still "otrs/index.pl" or otrs/customer.pl" that i need to type.
If i type "otrs" in the address bar i still have the "It works" message from apache, which is not something i want :p

Also just to be clear, the last change for virtual host config, it's the file "/etc/apache2/sites-available/default" right ?

Anyone can help ?

Best regards

[edit] to be clearer, here is my otrs.conf after following the tutorial:

Code: Select all

# --
# added for OTRS (http://otrs.org/)
# $Id: apache2-httpd.include.conf,v 1.25 2011/11/05 17:39:09 mb Exp $
# --

# agent, admin and customer frontend
#ScriptAlias /otrs/ "/opt/otrs/bin/cgi-bin/"
#Alias /otrs-web/ "/opt/otrs/var/httpd/htdocs/"
Alias /otrs-web/ "/opt/otrs/var/httpd/htdocs/"
Alias / "/opt/otrs/bin/cgi-bin/"

# activate this if you are using an Oracle database
#SetEnv ORACLE_HOME /path/to/your/oracle/
#SetEnv ORACLE_SID YOUR_SID
#SetEnv NLS_LANG AMERICAN_AMERICA.UTF8
#SetEnv NLS_DATE_FORMAT 'YYYY-MM-DD HH24:MI:SS'

# if mod_perl is used
<IfModule mod_perl.c>

    # load all otrs modules
    Perlrequire /opt/otrs/scripts/apache2-perl-startup.pl

    # Apache::Reload - Reload Perl Modules when Changed on Disk
    PerlModule Apache2::Reload
    PerlInitHandler Apache2::Reload
    PerlModule Apache2::RequestRec

    # set mod_perl2 options
#    <Location /otrs>
#        ErrorDocument 403 /otrs/customer.pl
#        ErrorDocument 403 /otrs/index.pl
#        SetHandler  perl-script
#        PerlResponseHandler ModPerl::Registry
#        Options +ExecCGI
#        PerlOptions +ParseHeaders
#        PerlOptions +SetupEnv
#        Order allow,deny
#        Allow from all
#    </Location>

    # set mod_perl2 option for generic interface
    <Location /otrs/nph-genericinterface.pl>
        PerlOptions -ParseHeaders
    </Location>

</IfModule>

# directory settings
<Directory "/opt/otrs/bin/cgi-bin/">
    AllowOverride None
    Options +ExecCGI -Includes
    Order allow,deny
    Allow from all
	#
    # Below is what we copied from the <Location> section
    # 
    ErrorDocument 403 /index.pl
    DirectoryIndex index.pl
    AddHandler  perl-script .pl .cgi
    PerlResponseHandler ModPerl::Registry
    PerlOptions +ParseHeaders
    PerlOptions +SetupEnv
</Directory>
<Directory "/opt/otrs/var/httpd/htdocs/">
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

<IfModule mod_headers.c>
    <Directory "/opt/otrs/var/httpd/htdocs/skins/*/*/css-cache">
        <FilesMatch "\.(css|CSS)$">
            Header set Cache-Control "max-age=2592000 must-revalidate"
        </FilesMatch>
    </Directory>

    <Directory "/opt/otrs/var/httpd/htdocs/js/js-cache">
        <FilesMatch "\.(js|JS)$">
            Header set Cache-Control "max-age=2592000 must-revalidate"
        </FilesMatch>
    </Directory>
</IfModule>

# MaxRequestsPerChild (so no apache child will be to big!)
MaxRequestsPerChild 4000
and my virtualhost file located in sites-available

Code: Select all

<VirtualHost *:80>
ServerAdmin webmaster@localhost

# enable mod_perl
    <Files ~ "\.(pl|cgi)$">
           SetHandler perl-script
           PerlResponseHandler ModPerl::Registry
           Options +ExecCGI
           PerlSendHeader On
    </Files>

	#DocumentRoot /var/www
	#DocumentRoot /opt/otrs/var/httpd/htdocs/ 
	DocumentRoot /opt/otrs/bin/cgi-bin/
	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory /var/www/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
	</Directory>

	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	<Directory "/usr/lib/cgi-bin">
		AllowOverride None
		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</Directory>

	ErrorLog /var/log/apache2/error.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn

	CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>
OTRS 3.1.5 on Ubuntu 12.04
Database: MySQL
Module: FAQ
Romaing
Znuny newbie
Posts: 60
Joined: 30 Mar 2012, 15:20
Znuny Version: 3.1.5

Re: url Redirection for customer.pl and index.pl

Post by Romaing »

ok i need at least the customers to not type a complicated address.

Changed the otrs.conf :

Code: Select all

# agent, admin and customer frontend
#ScriptAlias /otrs/ "/opt/otrs/bin/cgi-bin/"
#Alias /otrs-web/ "/opt/otrs/var/httpd/htdocs/"
Alias /otrs-web/ "/opt/otrs/var/httpd/htdocs/"
Alias /customer "/opt/otrs/bin/cgi-bin/"
and:

Code: Select all

# directory settings
<Directory "/opt/otrs/bin/cgi-bin/">
    AllowOverride None
    Options +ExecCGI -Includes
    Order allow,deny
    Allow from all
	#
    # Below is what we copied from the <Location> section
    # 
    ErrorDocument 403 /customer.pl
    DirectoryIndex customer.pl
    AddHandler  perl-script .pl .cgi
    PerlResponseHandler ModPerl::Registry
    PerlOptions +ParseHeaders
    PerlOptions +SetupEnv
</Directory>
so if i type now

Code: Select all

otrs/customer/
i get to customer login screen. Not bad but the last "/" really annoys me. Especially because typing "otrs/customer" just gives me a nasty error:
i get a redirection to http://otrs.company.local/customer/

with firefox displaying that it can't find at the address otrs.company.local.
OTRS 3.1.5 on Ubuntu 12.04
Database: MySQL
Module: FAQ
CSL
Znuny expert
Posts: 159
Joined: 11 Nov 2011, 19:27
Znuny Version: 3.0.11

Re: url Redirection for customer.pl and index.pl

Post by CSL »

I've set up a redirect on our frontend box that works as follows:

The document root (base URL) redirects to /otrs/customer.pl (both with and without trailing slash)
adding /otrs or /otrs/ to the base URL redirects to /otrs/index.pl

Here are the relevant lines from our otrs.conf file form within /etc/httpd/conf.d/

# Redirect agent interface
RedirectMatch ^/otrs$ /otrs/index.pl
RedirectMatch ^/otrs/$ /otrs/index.pl

# Redirect root folder
RedirectMatch ^/$ /otrs/customer.pl

So if you wanted the root to redirect to the agent interface instead of the customer, use:

# Redirect root folder
RedirectMatch ^/$ /otrs/index.pl

This also depends on your virtual host, document root, etc and other settings so it may not be a copy/paste fix, but this is how I've got ours to work.

As you say, information on this is extremely sparse and I spend a good week bashing my head against Apache tuts and editing the conf files until I worked it out.
Backend: OTRS 3.0.11 RedHat Enterprise Linux 6.2, Apache, MySQL with replication
Frontend: OTRS 3.0.11 RedHat Enterprise Linux 6.2 with SELinux, Apache SSL
adolfainsley8
Znuny newbie
Posts: 1
Joined: 19 Apr 2016, 13:20
Znuny Version: gdfgf

Re: url Redirection for customer.pl and index.pl

Post by adolfainsley8 »

And the only result i got is that i don't need to type the ip or hostname anymore, but it still "otrs/index.pl" or otrs/customer.pl" that i need to type???
== Solitaire ==
Locked