Hi dujmovicv,
I am also running this version of Ubuntu. You are using the wrong file for httpd...
I also got that file, and it was empty after installing Apache2 (and it's still empty). The "real" config file is
/etc/apache2/apache2.conf
so in your terminal do
Code:
vi /etc/apache2/apache2.conf
and what you SHOULD see is a bunch of commented out stuff. It starts out a full file.
Here's what I ended up doing, because I was imitating my work's VirtualHost setup:
in /etc/apache2/apache2.conf at the BOTTOM I think I UNcommented an Include, so that all my messing around wasn't in the main config file itself but another file that the main config looks at:

Originally Posted by
main config
# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/ <--note this is where you'll do the stuff dkLynn is talking about, with <Directory> and your mod_rewrite commands!
When you say "Include path/file" you're telling the main config to act as if you wrote it directly in there, but really it's safely in another file.
You already have the /var/www thing, great.
Now go check out /etc/apache2/sites-enabled and you should see something called "default" or maybe default with some 0's in there. I'm not sure if the 0's are an Ubuntu thing or maybe an Apache thing? We can refer to the file as "default" though.
Code:
vi /etc/apache2/sites-available/default
(or whatever your text editor of choice is)
There should already be a bunch of text in there, including your <Directory> stuff.

Originally Posted by
default
NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/
<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
ServerSignature On
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>
RewriteEngine On
RewriteLog /var/log/apache2/rewrite.log
RewriteLogLevel 5
RewriteRule (put your rewrite rules here)
</VirtualHost>
That's any Named virtual host, <virtualhost any>
that Document Root /var/www is why when in your regexes you have / (root) it knows you really mean /var/www/thefilesarehere
I think everything in the middle was already there...
then from "Rewrite engine on" is all added. You turn it on, state where logs are to go, loglevel, etc. I set mine high.
So when I was testing basic mod_rewrite I did this (I don't have PHP, so it was simpler):
in /var/www
I have
index.html
about.html
products.html
contact.html
each with h1's clearly stating the name of the file (so like you you have with your index.html and .php files)
And a test rewrite was
Code:
RewriteRule ^/index(\.html)?$ /about.html [L]
RewriteRule ^/about(\.html)?$ /index.html
Where I find by trial-and-error that it only worked if I start with ^/ for the pattern and / before the real file ("/about.html" is referring to "/var/www/about.html" because that's what you've got stated for / in your "default" file).
Because this isn't an .htaccess file, every time I edit this default file, I then need to
Code:
sudo /etc/init.d/apache2 reload
NOT the reload commands you see at apache.org (cause Debian just HAD to be different and weird, didn't they?? this caused me a lot of grief)
try to test your pages and rewrites in your web browser
Code:
http://localhost/index.html
for example shows about.html
then check your new log ends (the log will get huge fast, so I tail it)
Code:
tail /var/log/apache2/rewrite.log
to see what the logs say about your rewrite.
Hope that helped. Dwebian makes Apache a pain when you're getting started. Rich Bowen calls it "Debian-encumbered" lawlz.
Bookmarks