Forum Moderators: phranque

Message Too Old, No Replies

Rewrite Problem

Internal Server Error

         

fabiox

1:58 am on Apr 27, 2005 (gmt 0)

10+ Year Member



Hi,
I'm trying redirect any image for the file php.Look:
This is in .htaccess inside the directory.

php_value session.gc_maxlifetime 36000
php_value register_globals on
php_value max_execution_time 600

RewriteEngine on
RewriteRule ^(.+)\.gif¦jpg$ redirect.php

But not work. Return the message Internal Server Error.
Helps

jdMorgan

2:37 am on Apr 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



fabiox,

Welcome to WebmasterWorld!

What did your error log say? This file is the first place to check when you get a server error.

You might want to try adding one directive, and correcting the RewriteRule:


Options +FollowSymLinks
RewriteEngine on
RewriteRule \.(gif¦jpg)$ /redirect.php [L]

You must edit the broken pipe "¦" character above, and change it to a solid pipe character before use. Posting on this forum modifies the pipe character.

Jim

fabiox

12:34 pm on Apr 27, 2005 (gmt 0)

10+ Year Member



Thanks, but continue with error 500.
Here is config in httpd.conf the site.

-------------------------------------------
<VirtualHost www.domain.com:80>
ServerName www.domain.com
ServerAlias www.domain.com
DocumentRoot /home/domain/www/
ScriptAlias /cgi-bin/ "/home/domain/cgi-bin/"
ErrorLog /var/log/apache/domain.com-error_log
CustomLog /var/log/apache/domain.com-access_log combined
ServerAdmin webmaster@domain.com
<Directory /home/domain/www/>
Options -Indexes FollowSymLinks
AllowOverride AuthConfig
order allow,deny
allow from all
</Directory>
</VirtualHost>
-------------------------------------------------

It will be that AllowOverride? Set this for All and restart httpd?
The error log is with others lines , but nothing related with this error.

sitz

1:19 am on Apr 29, 2005 (gmt 0)

10+ Year Member



Like jd said, check your error log; the reason for Internal Server Errors is almost invariable logged there.

fabiox

1:59 am on Apr 29, 2005 (gmt 0)

10+ Year Member



Was the AllowOverride, i set as All and it functioned.
Thanks!

sitz

2:54 am on Apr 29, 2005 (gmt 0)

10+ Year Member



You *may* want to reconsider the use of 'AllowOverride all'; I'm not a huge fan (and I suspect folks are getting sick of hearing my rant on this). In *most* cases, it's probably safe (yes, I've calmed down somewhat. =) ), but it's rarely *necessary*. My previous rant on it is in [webmasterworld.com ]. If you don't feel like slogging through it (and, really, I wouldn't blame you), I'd take a look at [httpd.apache.org ] and figure out which Overrides you actually *need*, and just use those. I suspect you could leave the 'FollowSymlinks' in your httpd.conf and use the 'AllowOverride AuthConfig FileInfo' (although you may want to add 'Limit' to that as well).

Of course, all that said, since you have write access to your httpd.conf, you may just want to shift your RewriteRules there; per the 'API Phases' section of [httpd.apache.org ], performance of mod_rewrite is better when used in httpd.conf than when used in .htaccess files.