Unable To Rewrite In Apache

Support section for FREESCO v0.3.x 3rd Party Packages

Postby Marc » Wed May 02, 2007 4:20 am

Hi,

I am working with freesco 036 and apache_1.3.27_dingetje.
I am unable to get mod_rewrite working.
It seems enabled in the httpd.conf but the module is not loaded.

This can be seen with the command httpd -l.

Does anyone have this working?
Marc
pc1mh.nl.eu.org
User avatar
Marc
Senior Member
 
Posts: 85
Joined: Fri May 17, 2002 3:42 pm
Location: The kingdom of the Netherlands, Twente

Postby Doc Nielsen » Wed May 02, 2007 4:29 am

-l shows compiled in modules, not loaded modules...

try -t -D DUMP_MODULES

(i have apache2, it might not work on your apache)
I work to better myself, for the sake of all mankind...
Everyone talks about changing the world, but no one talks about changing themselves.
User avatar
Doc Nielsen
Junior Member
 
Posts: 41
Joined: Wed Nov 14, 2001 2:02 am
Location: Copenhagen, Denmark

Postby dingetje » Wed May 02, 2007 5:11 am

Code: Select all
LoadModule rewrite_module     libexec/mod_rewrite.so

Code: Select all
AddModule mod_rewrite.c

Code: Select all
#
# Rewrite rules
#
<IfModule mod_rewrite.c>

RewriteEngine On
RewriteRule .*favicon.ico /favicon.ico [PT,NS]
</IfModule>


I think you may have forgotten to switch it "On"?

"Works for Me" ™ ;)

Tip: you can load the mod_info module and then enable the "special" Server-Info URL, like so:

Code: Select all
#
# Allow remote server configuration reports, with the URL of
# http://servername/server-info (requires that mod_info.c be loaded).
# Add ".your-domain.com" to match your domain to enable.
#
<Location /server-info>
    SetHandler server-info
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1 192.168.0.0/24 10.0.0.0/16
</Location>


For security reasons this URL can only be viewed from the 192.168.x.x and 10.x.x.x local networks, so change that if you use another numbering scheme for your LAN and/or add an external IP address if you need to view the info from a trusted remote location. The server info page will show all loaded modules and their settings. Very useful!
GreetZ
http://dingetje.homeip.net

"Software is like sex: it's better when it's free." - LINUS TORVALDS
User avatar
dingetje
Senior Advanced Member
 
Posts: 998
Joined: Wed Nov 14, 2001 12:13 pm
Location: The Netherlands

Postby Marc » Wed May 02, 2007 9:23 am

Hi,

Thanks for the info. Again I learned some valuable tricks.

I cannot get mod_rewrite working with gallery 2.2.1. If I do the rewrite tests REWRITE_FAILs.

If mod_rewrite is loaded I might be misconfiguring gallery.

It seems to me mod_rewrite is loaded but I am not 100% sure.

I opened <a href='http://pc1mh.kicks-ass.net/server-status' target='_blank'>http://pc1mh.kicks-ass.net/server-status</a> and <a href='http://pc1mh.kicks-ass.net/server-info' target='_blank'>http://pc1mh.kicks-ass.net/server-info</a>. Please take a look and confirm. (And please if possible tell me whats wrong with my virtual directories because its a bit messy.)

Can anyone confirm a working rewrite in gallery?
Marc
pc1mh.nl.eu.org
User avatar
Marc
Senior Member
 
Posts: 85
Joined: Fri May 17, 2002 3:42 pm
Location: The kingdom of the Netherlands, Twente

Postby dingetje » Wed May 02, 2007 12:24 pm

It seems to me mod_rewrite is loaded but I am not 100% sure.

Its loaded. Your server-info page clearly shows this!

Is the rewrite working via a .htaccess file? In that case you may have to add:

Code: Select all
    AllowOverride All


for the gallery director.
GreetZ
http://dingetje.homeip.net

"Software is like sex: it's better when it's free." - LINUS TORVALDS
User avatar
dingetje
Senior Advanced Member
 
Posts: 998
Joined: Wed Nov 14, 2001 12:13 pm
Location: The Netherlands

Postby Marc » Wed May 02, 2007 3:53 pm

Hi,

Gallery was unable to recognize wod_rewrite. If I tell Gallery to go ahead my urls are shorter but the pages are not found anymore.(404)
Gallery can write to the .htaccess file no problem. The test says ok.
I dismissed the obvious. I killed cookies, deleted cache, used differend browser, etc.

I am a bit flabbergasted. As I come to remember, I never had it working. I did the rewrite trick with php and virtual direcotories.


OK I have it working. It had to be the apache virtual directory configuration.
This virtual directory stuff is very complicating and I never see enough examples. A lot of documentation and words but never example syntaxes.

Ha revolution. Here a working virtual directory for the httpd.conf.(messy but working)
Code: Select all
<VirtualHost *>
<Directory />
    Options FollowSymLinks
    AllowOverride FileInfo Options
</Directory>
RewriteEngine On
DocumentRoot /www/pc1mh
ServerName pc1mh.is-a-geek.com/pc1mh
ServerAlias *.pc1mh.is-a-geek.com/pc1mh
</VirtualHost>

<Directory /www/pc1mh>
    AllowOverride FileInfo Options
</Directory>

Thanks for the help.
Marc
pc1mh.nl.eu.org
User avatar
Marc
Senior Member
 
Posts: 85
Joined: Fri May 17, 2002 3:42 pm
Location: The kingdom of the Netherlands, Twente

Postby dingetje » Thu May 03, 2007 6:11 am

I see some strange habits in your virtual server config, one is the use of a subdirectory in your ServerName? I'm pretty sure that is a no-no! A ServerName should be a FQDN and nothing else.

Also your documentroot is /www/pc1mh, yet the first <Directory /> tag points to / and not /www/pc1mh! To solve this you've added another <Directory /www/pc1mh> outside the virtual directory!! :huh:
GreetZ
http://dingetje.homeip.net

"Software is like sex: it's better when it's free." - LINUS TORVALDS
User avatar
dingetje
Senior Advanced Member
 
Posts: 998
Joined: Wed Nov 14, 2001 12:13 pm
Location: The Netherlands


Return to 3rd Party Package Support for FREESCO v0.3.x

Who is online

Users browsing this forum: No registered users and 1 guest

cron