Forum Moderators: phranque

Message Too Old, No Replies

Mod Rewrite

         

miller2348

4:54 pm on Nov 1, 2007 (gmt 0)

10+ Year Member



I just moved to php5 yesterday. Everything on my server works except for a Mapping script that uses htaccess.

The htaccess file I'm using contains this:


rewriteEngine on
RewriteBase /
RewriteRule ^\/(\d+)\/World-Map-(.*)\.png$ http://www.example.com/Generators/World_Map_Generator/map.php/World-Map-$2_$1.png [L]
RewriteRule ^World-Map-(.*)_(.*)\.png$ http://www.example.com/Generators/World_Map_Generator/map.php/World-Map-$1_$2.png [L]

An example of a image URL that should work:
http://www.example.com/Generators/World_Map_Generator/World-Map-1_685891.png

If you manually put in the page like the htaccess should direct it to, you'll see the image:
http://www.example.com/Generators/World_Map_Generator/map.php/World-Map-1_685891.png

So for some reason, the htaccess isn't working since going to php5 and I have no idea why. I get an blank page with just, "No input file specified".

Can anyone give me a hand with this please?

[edited by: jdMorgan at 6:09 pm (utc) on Nov. 1, 2007]
[edit reason] No URLs, please. See TOS. [/edit]

jdMorgan

6:11 pm on Nov 1, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your first rule should never be invoked, because it requires a leading slash, and that leading slash will never be present in the URL 'seen' by RewriteRule in an .htaccess context. So I assume that you mean that this code is new, in addition to the PHP upgrade.

It is not necessary to escape "/" slashes in mod_rewrite patterns, and several of your patterns use ".*" which is both ambiguous and (therefore) inefficient to process. Also, support for "PERL-style" regular-expressions tokens like "\d" is not universal. Therefore, I'd suggest the following changes:


RewriteEngine on
RewriteBase /
RewriteRule ^([0-9]+)/World-Map-([^.]+)\.png$ http://www.example.com/Generators/World_Map_Generator/map.php/World-Map-$2_$1.png [L]
RewriteRule ^World-Map-([^_]+)_([^.]+)\.png$ http://www.example.com/Generators/World_Map_Generator/map.php/World-Map-$1_$2.png [L]

Depending on where in your directory structure this code is located, you may also need to add an exclusion to each rule, such as:

RewriteCond %{REQUEST_URI} !/map\.php/

to prevent this code from looping recursively.

However, your first stop with this kind of problem should be the server error logs? Is there anything useful in there?

Jim

miller2348

6:26 pm on Nov 1, 2007 (gmt 0)

10+ Year Member



Sorry about using the URLs. I'll make sure to not do that again.

I did try what you suggested and it didn't work. I don't have anything in my error log for this either to help out. Even with your changes, I keep getting: "No input file specified."

As for the location of the htaccess file, it's located in the World_Map_Generator folder.

This was working just fine before moving to php5 and has worked for close to a year without a problem. I don't know if the allow_url_includes php has anything to do with it as that's the reason I moved to php5 to disable that feature but I can't see it causing this problem with an htaccess file.

Do you have something else for me to try?

jdMorgan

6:58 pm on Nov 1, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Please tell us more about your hosting, and what was done in the "move to PHP5"

Is this your own server?
What version of Apache?
How was the move accomplished? -- Who did the work? Was it done just for your site, or server-wide?

Jim

miller2348

7:26 pm on Nov 1, 2007 (gmt 0)

10+ Year Member



Yes this is my own dedicated server.

It was previously php4 and was upgraded to php 5.2.4 because of an exploit on a script that php5 isn't. It has to do with the allow remote url includes which is turned off in php5 for me.

Apache is 1.3.39

It was done by Platinum server management and should have been a server wide update.

jdMorgan

7:37 pm on Nov 1, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Make sure that the LoadModule order places the directive that loads php *ahead* of the one that loads mod_rewrite -- On Apache 1.3.x, modules are executed in the reverse order that they are loaded.

*If* you are using AcceptPathInfo, make sure that that setting is still "on". This would likely be the case unless you have further RewruteRules that parse your URLs like
www.example.com/Generators/World_Map_Generator/map.php/World-Map-$1_$2.png
and convert them to a form such as
www.example.com/Generators/World_Map_Generator/map.php?image=World-Map-$1_$2.png

Jim