Rewrite Rule Configuration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi everybody, I'm having a problem configuring a rewrite rule for my site.

I'm using apache 2.2.22 on Debian 7.

I used to have a single site under /var/www/Intranet/public. The former rewrite rule configuration was on an .htaccess file in said directory having the following:

SetEnv APPLICATION_ENV development
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

And in the main apache config file's DocumentRoot was set to /var/www/Intranet/public

We're tidying up our webserver configuration as well as adding some new sites so now we want our DocumentRoot to be /var/www/.

We also moved the configuration in the .htaccess file to a <Directory> section in the SSL vhost file configuration and are disabling per directory overrides to tighten security.

The SSL vhost config file has the following:

DocumentRoot /var/www
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    deny from all
</Directory>
<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
</Directory>
<Directory /var/www/Intranet/>
    SetEnv APPLICATION_ENV development
    Options FollowSymLinks
    RewriteEngine On
    RewriteBase /Intranet/
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^.*$ public/index.php [NC,L]
</Directory>
Plus configs for SSLEngine and certificates.

I want requests made to any url under /var/www/Intranet/ that doesn't match a file, link or directory to be handled by /var/www/Intranet/public/index.php, however it's getting served by /var/www/Intranet/index.php.

This latter index.php has a redirect to public and any access to Intranet seems to be served by it. For example /Intranet/lalala gets translated to /Intranet/public/ and Intranet/public/lalala gets translated to
/Intranet/public/public/ and Firefox warns of an infinite redirection.

Does anybody know what I'm doing wrong?

Thanks in advance

Pablo

--
Ing. Pablo Alfaro Piñeyro
MotionSoft Consulting S.R.L.
Tel: 095 938 487

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux