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开发者_如何学JAVA /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
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_html/index.html
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.
精彩评论