|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
SitePoint Zealot
![]() ![]() Join Date: Oct 2005
Location: Milton Keynes, UK
Posts: 180
|
Odd mod_rewrite issue
Ok I'm confused.
I have about 20 virtualhosts set up on my development machine. mod_rewrite works on a lot of them. I've just tried to create a new one in the exact same way... mod_rewrite wont work. My .htaccess has Code:
RewriteEngine On RewriteRule ^(.*)$ test.php If I change it to: Code:
foo RewriteEngine On RewriteRule ^(.*)$ test.php However... If I change it to Code:
RewriteEngine On foo RewriteRule ^(.*)$ test.php Anything I put after RewriteEngine On is ignored. I've tried DirectoryIndex. In the rewrite log I just get: Code:
127.0.0.1 - - [06/Nov/2009:13:21:01 +0000] [dev.dev/sid#160f118][rid#1ece0b8/initial] (1) [perdir C:/www/dev/httpdocs/] pass through C:/www/dev/httpdocs/index2.php Code:
[Fri Nov 06 13:23:44 2009] [error] [client 127.0.0.1] script 'C:/www/dev/httpdocs/index2.php' not found or unable to stat Any ideas? I'm completley lost. I've tried copying a .htaccess file from a working vhost and that doesn't work either. My vhost config looks like this: Code:
<VirtualHost *:80>
DocumentRoot "C:\www\ipa\httpdocs"
ServerName ipa.dev
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:\www\dev\httpdocs"
ServerName dev.dev
</VirtualHost>
Any ideas? I am thoroughly confused. |
|
|
|
|
|
#2 |
|
Hosting
![]() ![]() Join Date: Feb 2002
Location: Auckland
Posts: 10,683
|
TB,
First, gudonya for setting up a development machine (test server) with VirtualHosts! Second, learn some regex (start with the tutorial article linked in my signature)! Do you not think that test.php will match (.*)? In other words, loopy! mod_rewrite circles around through its own code until it can find no matches before it releases Apache to serve a file - unless it loops at which time it's supposed to just give up and quit (without taking the server down - which started with Apache 2.0). Consider yourself lucky! foo: As you are aware, it's an "illegal" directive which is MEANT to cause a 500 response from the server. I have no idea why it didn't with your series of tests. Regards, DK |
|
|
|
|
|
#3 |
|
SitePoint Zealot
![]() ![]() Join Date: Oct 2005
Location: Milton Keynes, UK
Posts: 180
|
I wanted foo to cause a 500 error, to check the .htaccess was being parsed.
Anyway after a lot of trial and error I found the cause of the issue. NotePad++ had the file mode set to mac (probably due to opening files from a collegue who's on a mac) so i'm not sure what combination of \r\n it used but changing it to unix file mode (\n) fixed the problem. Odd, but glad I worked it out. Just a shame it took several hours of playing around! |
|
|
|
|
|
#4 |
|
Hosting
![]() ![]() Join Date: Feb 2002
Location: Auckland
Posts: 10,683
|
TB,
Thanks for letting us know that all is okay (and the reason for the problem in the first place). Wouldn't it be nice if all three OS types would "converge?" Regards, DK |
|
|
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 09:21.










Linear Mode
