i am trying to use the mod_rewrite.c module to do some url rewriting for my site. i am doing this on my WinXP dev station. i know that what i am trying to do will most likely work on the server i eventually upload this to, but i would like to get it to work on my home comp as well. here is my quandry:
into my httpd.conf file everything works fine. if i place them into a .htaccess file i get an internal server error. for this directory i have AllowOverride set to All so i don't believe it is an permission issue. any ideas would be much appreciated.
strange because (I know you don't want to hear this) it works on my box.
.htaccess is placed in you document-root-dir?
are there still other RewriteRules in your httpd.conf?
my version of Apache is 1.3.14. about the only thing that i could see making a huge difference is that the rewrite module is being loaded as a dll (modules/ApacheModuleRewrite.dll). not sure if the dll works differently then a hard coded module or not but just thought i would make that point. something else that might weigh in here is that i am using phpTriad (the PHP/MySQL/Apache installer), would you reccomend i do a complete reinstall doing each install my self?
Takuma, the reason people say that is because in the explorer interface you can't name a file with nothing before the "." but you can do it in a dos box.
i looked at my rewritelog and this is what i found:
keep in mind that g:/web page dev/cm/ is my DocumentRoot
it seems to be doing some weird matching and trying to apply the patterns to a directory instead of the url. and at the same time its making a url "news.php/2". im just stumpped as to why it is doing this in .htaccess yet it works fine httpd.conf.
to .htaccess on my box at home to get rid of some nimda-scanners (will not do it for long, only testing ). There is a flag you have to set for full regular expression support, maybe ^ is in there.
take a look in the apache manual @'Run-time Configuration Directives'
the third rule works because there is no file named forum.php in the root directory.
insummary it appears that Apache or Windows (not sure which) looks up files using only the name of the file (that is without the extension. ie. looks for any file named news.* no matter what the requested files extension was) and the only time it does use the extension to find the file is when there is abiguity as which file was requested.
my question is now, how do you force Apache/Win32 to always use a files extension and not try to shortcut the system?
well, i circumvented the problem by renaming problem files to rw_{whatever}.php. in this way a request to /news/2 cannot be confused with a request to /rw_news.php. thank you all for youe help. maybe in the future i will find a cleaner solution (like switching my desktop to linux!! )
switching to linux is no escape, I tried this your example at my server, too. Same result.
I really would like to understand the name mangeling apache performs.
I know how to name files that they are found (page.html.en and so on) but I do not know how to force that only exact requests will be served :-S
volka, i went back and looked at the mod_negotiation.c documentation and found out it was because of the MultiViews Option. I disabled that and everything works now without renaming the files.
disabling MultiView completely is no option for me
I would like to disable it for certain mimetypes (script is NOT script.php)
but I'm glad you're happy