Possibly confusing configuration conflict in the Site Admin

irtfm

Joined: 2005-03-06
Posts: 3
Posted: Sun, 2005-03-06 12:40

I ended up resolving this on my own but thought it could be avoided for other users.
Under the URL Style it isn't particularly clear that it conflicts with mod_rewrite. I ran the test, received no errors so enabled it. Then in configuring modules I configured the mod_rewrite one thinking it was part of the same.
Only after behavior became strange, no CSS because of path problems did I go back and read the rewrite module. Seeing it say that it wasn't compatible with URL Style made me realize the problem.
Would it be possible to put a similar warning under the URL Style configuration block saying it isn't compatible with the rewrite module ?
This is my first time using G2, just installed beta1 and it is great. I am really very impressed with the changes since G1. Congratulations !

Cheers,

fm

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Mon, 2005-03-07 04:07

I'm in the process of deleting the "Short URL" code. The rewrite module will be the canonical way to get short urls by the next beta.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2005-03-07 05:31

while I agree it will be less confusing to have one method, do you think the ease of use and compatibility of the rewrite module will improve to the level of the pathinfo stuff? Pathinfo didn't conflict with G1 redirects and assuming your server supports it, you simply turn it on.. no mucking around with permissions and settings to get a .htaccess in place... I haven't played around with rewrite module yet, so maybe it's adding a lot of functionality i'm not aware of.. but it's clear from the forums after beta release that:
a) short urls is a popular feature
b) many people are having some trouble either setting it up or using it
also, won't removing pathinfo leave IIS users with no short urls?

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Mon, 2005-03-07 05:52

The main reason why I'm getting rid of it is that it stands in the way of making image downloads really efficient. If we stop using PathInfo and only use mod_rewrite, then I can get image download response time down to 20 ms from about 200ms (on my dual PIII 700mhz dev box). I've gotten it down to 6ms with Turck enabled. Right now, image download time is a pretty big factor in performance. But if we use PathInfo we have to load up an inordinate amount of the framework to get our parsing code to figure out that it's an image download and transfer it.

I think that with some tuning, mod_rewrite will be just as flexible as the PathInfo solution for Apache. I'm also confident that it's mostly universally available so once we to the configuration sweet spot with it we'll be able to get it working in most places.

If IIS does not support something similar to mod_rewrite in terms of features and flexibility, I think that we can write a separate module that does PHP based short url rewriting for IIS. The module can come with a simple facade PHP and generate urls directly into that page. The downside is that they'd have to put a .php file up in the gallery2 directory in order for it to work but we can probably sort that out.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-03-07 07:04

what about a custom tailored mini download.php just for image downloads (path_info instead of mod_rewrite)? or do you think you can't make it shorter / less expensive than main.php with all short cuts for downloaditem links?

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Tue, 2005-03-08 10:33

I think what I have now (out for review to mindless) is pretty close to the fastest that we're going to see. I'm still loading a little more code than we need to, but I think that it's fast enough. I really like having the single entry point so I'd rather avoid creating a second PHP file just for downloads (I've been resisting that idea for some time now :-) ). After this change goes in, let's reassess the situation.

 
firepol
firepol's picture

Joined: 2004-05-19
Posts: 99
Posted: Sat, 2005-03-12 10:48

bharat, I was going to write a post asking: where has the "enable short urls" option disappeared, since i can't find it anymore in the Site Admin's "General" tab?

Hopefully I found this topic where you state that you were going to remove it. Well, now that it's removed I can no more make the short urls work.

Previously I had some problems in the URL rewrite module, but activating the option from the general tab made it working.

Now I need to deal with the URL rewrite module, if i try to configure it i get this warning:

Quote:
Apache mod_rewrite is not installed or not enabled

I checked the /etc/apache/modules.conf of my apache installation on my debian server, and mod_rewrite appears installed:

Quote:
LoadModule rewrite_module /usr/lib/apache/1.3/mod_rewrite.so

What's wrong? I can't get the short urls working... before it worked.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sat, 2005-03-12 23:00

Hm. I changed a lot of stuff, but I didn't change the way that it detects that mod_rewrite is working. Can you save the HTML page from the rewrite setup page and post it here so that we can take a look at it? Thanks!

 
firepol
firepol's picture

Joined: 2004-05-19
Posts: 99
Posted: Sun, 2005-03-13 10:10

Hi bharat, see attachment zip for the page that I get in the Site Admin > Modules > URL Rewrite Setup.

I tried to manually create a .htaccess file in the G2 root and chmod it 777, so that it could be upgraded with the URL Rewrite Setup option to upgrade that file.

The .htaccess file generated contains:

# BEGIN Url Rewrite section
# (Automatically generated.  Do not edit this section)
<IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine On

    RewriteBase /gallery2/
    
    # Only redirect to Gallery base file if there's no such file already, and
    # make sure gallery_remote2.php gets generates a 404 in order to be compatible
    # with Gallery Remote.
    RewriteCond %{REQUEST_FILENAME} !gallery\_remote2\.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^v/(.*).html       /gallery2/main.php?g2_view=core:ShowItem&g2_path=/$1 [QSA]
    RewriteRule ^v/(.*)            /gallery2/main.php?g2_view=core:ShowItem&g2_path=/$1 [QSA]
    RewriteRule ^d/([0-9]+).*?     /gallery2/main.php?g2_view=core:DownloadItem&g2_itemId=$1 [QSA]
</IfModule>

# END Url Rewrite section 

But short urls were not working, I got "Not found" error pages:

Quote:
Not Found
The requested URL /gallery2/v/ was not found on this server.

Apache/1.3.31 Server at t800 Port 80

As explained int he previous topic, mod_rewrite module is installed in my apache installation... and short URLS were working before the new changes...

Here the zip file:

 
jamzyamz
jamzyamz's picture

Joined: 2004-01-12
Posts: 154
Posted: Sun, 2005-03-13 10:26

I have the same problem, rewrite says everything is good. When I have the script create the htaccess file (or if I do it manually) I get error 502 internal server errors. the old way worked fine.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Mon, 2005-03-14 00:50

Stay tuned. Pelle is working on reviving the old way (with some new constraints) which will take a week or more. You can try his experimental module from here if you want to ride on the bleeding edge.