Forum Moderators: phranque
Localhost is Windows2000, Apache 1.3.27 conf file has:
LoadModule rewrite_module modules/mod_rewrite.so
AddModule mod_rewrite.c
<Directory "C:/Apache/Apache/htdocs">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
.htaccess file has:
RewriteEngine on
RewriteCond %{REQUEST_URI}!\.(php¦txt¦jpe?g¦gif¦png¦css¦js¦inc)
RewriteRule (.*)$ /page.php?path=$1
From what I can see, my local machine is configured correctly, I am right? If so, why does the .htaccess file not work?
Comments appreciated, been banging my head against wall for two days now!
RewriteRule ^silly\.html$ /exists.html [L]
Secondly, your <Directory> path seems complicated (should it contain "C:/Apache/Apache"?), and I don't see a <DocumentRoot> directive. If you are not using Multi-Views now, turn them off until actually needed -- content negotiation can cause a lot of side-issues.
Examining your error log can be helpful, too.
Jim
1. Added the simple RewriteRule and commented out the other:
RewriteCond %{REQUEST_URI}!\.(php¦txt¦jpe?g¦gif¦png¦css¦js¦inc)
#RewriteRule (.*)$ /page.php?path=$1
RewriteRule ^silly\.html$ /exists.html [L]
2. Turned off MultiViews
3. DocumentRoot "C:/Apache/Apache/htdocs" was/is in the httpd.conf (Repeated dir name as used to have Apache/Apache2 in there as well)
Unfortunately gave the same error 404 (and yes, "exists.html" exists!)
"file does not exist: c:/apache/apache/htdocs/exists.html"
So the rewrite *is* kicking in, but it's not using the folder root (where the .htaccess file is) as it's starting point, it's using the server root.
So, I need to work out why it is not using the folder root...
Although this works on remote server:
RewriteRule (.*)$ /page.php?path=$1
#RewriteRule ^silly\.html$ /exists.html [L]
I need to drop the "/" for the redirect on the Windoze desktop:
RewriteRule (.*)$ page.php?path=$1
#RewriteRule ^silly\.html$ exists.html [L]
Don't know why that's the case, but it works. Thanks for your guidance!
(Interestingly, some relative urls are also showing up relative to server root, not folder root, so I guess there's a config missing somewhere?)
This is the line from the .htacess file:
RewriteRule ^silly\.html$ exists.html [L]
If the file "exists.html" does *not* exist, the error in my log is:
File does not exist: c:/apache/apache/htdocs/bookabed/exists.html
Fair enough, the redirect is working, and cannot find the file. But this is the error I get when the file *does* exist:
Filename is not valid: c:/apache/apache/htdocs/bookabed/c
And the browser reads: Forbidden
You don't have permission to access /bookabed/c:/apache/apache/htdocs/bookabed/exists.html on this server.
What is going on here? If the file doesn't exist, the error is making sense - but if the file does exist, the error makes no sense at all!
Hitting the road tomorrow, really wanted to take a working site on my laptop with me, so help much apprecaited.
Jim
It seems it's the the RewriteCond %{REQUEST_FILENAME} -f that's the
problem - windows problems normally are to do with files...so comment out or remove lines like these:
#RewriteCond %{REQUEST_FILENAME} -f
#RewriteRule .+ %{REQUEST_FILENAME} [L]
Not quite the ideal solution, but mostly I think it'll work until someone works out how to check for existence of files on windoze XP!