First off, I told you wrong. The correct file is:
/etc/apache2/sites-available/000-default
not:
/etc/apache2/sites-available/default
My apologies for that mistake.
You will need to load the rewrite_mod for apache:
sudo a2enmod rewrite
You also need to change AllowOverride from None to All in the first 2 directory blocks.
A better example for this is here:
http://www.xpheas.com/mod_rewrite-Ap...Gutsy_a18.html
Here is an example of /etc/apache2/sites-available/000-default using a rewrite for phpmyadmin.
If you do not use the default conf change to the conf you created for your main site.
Quote:
NameVirtualHost xxx.xxx.x.xxx:80
<VirtualHost xxx.xxx.x.xx:80>
ServerName mysite.com
ServerAlias www.mysite.com
ServerAdmin webmaster@mysite.com
DocumentRoot /var/www/mysite/
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/mysite/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
# This directive allows us to have apache2's default start page
# in /apache2-default/, but still have / go to the right place
# RedirectMatch ^/$ /apache2-default/
</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>
<IfModule mod_rewrite.c>
<IfModule mod_ssl.c>
<Location /phpmyadmin>
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://mysite.com/php_redirect [R]
</Location>
</IfModule>
</IfModule>
</VirtualHost>
|
Just a note, I came across this in the Squirrelmail configuration.
Let me know if this helped.