Apache2 – how to exclude alias from rewrite rules

apache-2.2mod-aliasmod-rewrite

I have setup mod_rewrite and mod_alias on Apache2 on Debian (in a test server).

I have the following rewrite code in /etc/apache2/sites-available/default:

<Directory />
  Options FollowSymLinks
  AllowOverride All
  RewriteEngine on
  RewriteCond %{REQUEST_URI} !\.(php|html|css|js|gif|png|jpe?g)$
  RewriteRule (.*)$ /index.php [L]
</Directory>

I have the following alias code that is setup by default from the phpmyadmin package (loaded via apt-get install phpmyadmin and located in /etc/apache2/conf.d/phpmyadmin.conf):

Alias /phpmyadmin /usr/share/phpmyadmin

Everytime I load http://my.test.server/phpmyadmin, it goes to http://my.test.server/index.php and not the alias (which is bypassed/ignored?).

How do I setup an exclusion rule to allow aliases to pass through (even if the alias is setup in a different file?)

Best Answer

Exclude the URIs containing "/phpmyadmin/" if you don't want them redirected:

RewriteCond   %{REQUEST_URI}  !/phpmyadmin/.*
Related Topic