views:

589

answers:

2

My apologies if this is an easy one. I have Googled it up the hizzy to no avail.

I am running Ubuntu 9.04, Jaunty Jackelope and Apache2. After much trouble, I finally enabled mod_rewrite, and my .htaccess file is attempting to do it's thing, but is failing. This is my setup.

In /etc/apache2/conf.d/ I have a file called apeace-public-html.conf. It reads as follows:

# makes /home/apeace/public_html/ available through /localhost/apeace

Alias /apeace /home/apeace/public_html/

And in /home/apeace/public_html/ I have the following .htaccess file:

Options +FollowSymlinks
RewriteEngine on

RewriteRule ^test\.html$ index.html

Also in /home/apeace/public_html/ I have a file named index.html, but I do NOT have a file named test.html. It seems to me that this rewrite should show index.html when I try to access http://localhost/apeace/test.html. However, this is the error I get:

Not Found

The requested URL /home/apeace/public_html/index.html was not found on this server.

So the question is, what in the world am I doing wrong?

Much thanks.

-apeace

+1  A: 

Your rewrite rule is working correctly since it's telling you it can't find "index.html". If you went to test.html and it said it can't find "test.html" then your rewrite rule would be at fault.

So what this means is that something else is wrong in your setup, whether it's a bad file or directory name somewhere, or whatever else. Make sure there's nothing basic you're overlooking.

But in answer to your question (especially the title), your htaccess is fine.

Gabriel Hurley
Sorry I wasn't clear enough :P I meant to access /test.html and be given /index.html, since index.html existed and test.html did not exist. However, it turned out that the other gentleman's answer was correct.
apeace
+1  A: 

Just a guess here, but can you try to make the RewriteRule like ^test.html$ /apeace/index.html

From the error message, it seems it is translating `http://localhost/apeace/test.html to http://localhost/home/apeace/public%5Fhtml/index.html

Rob Di Marco
This worked. Thank you SO much. I can't believe it was that simple.
apeace