You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Sam Carleton <sc...@miltonstreet.com> on 2008/03/29 04:42:34 UTC

[users@httpd] Where to place rewrite rules?

My application uses Apache to run a closed network Kiosk system.  One
of my customers is having very strange performance issues, it is
taking 45 seconds to load 12 thumbnail files that are only about 4K in
size.  I am using some rewrite rules to make dynamic pages and file
handlers look static to the kiosk browsers so they will cache them.

In analyzing my customers log file from running Filemon (Windows tool
to log file IO), it looks like Apache is trying to find the URL before
the RewriteRules are running.  Is this normal?  If not, do I have my
rewrite rules in the right place?

DocumentRoot "D:/MSDev/PhotoParata/httpd/htdocs"
SetEnv TMP "D:/MSDev/PhotoParata/httpd/tmp"
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Satisfy all
</Directory>

<Directory "D:/MSDev/PhotoParata/httpd/htdocs">
    Options SymLinksIfOwnerMatch
    AllowOverride all
    Order allow,deny
    Allow from all
    PhotoParataCfg conf/PhotoParata.conf
    RewriteEngine On
    RewriteRule ^images/([^/]+)/([^/]+)$ theImage?fldoid=$1&imgoid=$2 [L]
    RewriteRule ^images/([^/]+)/([^/]+)/([^/]+)$
theImage?fldoid=$1&imgoid=$2&tn=$3 [L]
    RewriteRule ^category/([^/]+)$ index.php?fldoid=$1 [L]
    RewriteRule ^category/([^/]+)/i/([^/]+)$ index.php?fldoid=$1&imgoid=$2 [L]
    RewriteRule ^category/([^/]+)/p/([\d]*)$ index.php?fldoid=$1&p=$2 [L]
</Directory>

Sam

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Where to place rewrite rules?

Posted by Sam Carleton <sc...@miltonstreet.com>.
Attached is the file, zipped up.  Extract the .htaccess file and place it in:

C:\Program Files\Miltonstreet Software\Photo Parata733\httpd\htdocs\

Sam

On Sat, Mar 29, 2008 at 11:04 AM, Eric Covener <co...@gmail.com> wrote:
> On Sat, Mar 29, 2008 at 8:46 AM, Sam Carleton
>  <sc...@miltonstreet.com> wrote:
>  > Eric,
>  >
>  >  When I do the following, the rewrite rules don't seem to work.  Where
>  >  should I be placing the rewrite rules and what settings should I have
>  >  for AllowOverride to stop it from looking for the .htaccess?
>
>  RewriteRules need to be in the proper virtual host, AllowOverride none
>  prevents apache from looking for .htaccess files
>
>  When you pull your rules out of Directory/htaccess,  the URL you're
>  testing against changes (the per-directory component hasn't been
>  stripped out -- now it always starts with a slash)
>
>
>
>  --
>  Eric Covener
>  covener@gmail.com
>
>  ---------------------------------------------------------------------
>  The official User-To-User support forum of the Apache HTTP Server Project.
>  See <URL:http://httpd.apache.org/userslist.html> for more info.
>  To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
>  For additional commands, e-mail: users-help@httpd.apache.org
>
>



-- 
The contents of this e-mail are intended for the named addressee only.
It contains information that may be confidential. Unless you are the
named addressee or an authorized designee, you may not copy or use it,
or disclose it to anyone else. If you received it in error please
notify us immediately and then destroy it.

Re: [users@httpd] Where to place rewrite rules?

Posted by Sam Carleton <sc...@miltonstreet.com>.
Sorry about the last email a few minutes ago, that was meant for my
customer, trying to figure out why Apache is running so slow for
him...

On Sat, Mar 29, 2008 at 11:04 AM, Eric Covener <co...@gmail.com> wrote:
> On Sat, Mar 29, 2008 at 8:46 AM, Sam Carleton
>  <sc...@miltonstreet.com> wrote:
>  > Eric,
>  >
>  >  When I do the following, the rewrite rules don't seem to work.  Where
>  >  should I be placing the rewrite rules and what settings should I have
>  >  for AllowOverride to stop it from looking for the .htaccess?
>
>  RewriteRules need to be in the proper virtual host, AllowOverride none
>  prevents apache from looking for .htaccess files

So AllowOverride none does not effect DirectoryIndex?

>  When you pull your rules out of Directory/htaccess,  the URL you're
>  testing against changes (the per-directory component hasn't been
>  stripped out -- now it always starts with a slash)

Ok, so I need to add the leading slash.  The first two rules are to
rewrite the URL for my Apache C Module which I currently have handling
a location.  something is going wrong because I do see in the rewrite
rule log that it is getting rewritten, but the Apache C Module isn't
getting the handler anymore.  Here is what I have right now, not
scoped in anything else:

RewriteEngine On
RewriteRule ^/images/([^/]+)/([^/]+)$ /theImage?fldoid=$1&imgoid=$2 [L]
RewriteRule ^/images/([^/]+)/([^/]+)/([^/]+)$
/theImage?fldoid=$1&imgoid=$2&tn=$3 [L]
RewriteRule ^/category/([^/]+)$ /index.php?fldoid=$1 [L]
RewriteRule ^/category/([^/]+)/i/([^/]+)$ /index.php?fldoid=$1&imgoid=$2 [L]
RewriteRule ^/category/([^/]+)/p/([\d]*)$ /index.php?fldoid=$1&p=$2 [L]

<Location /theImage>
    SetHandler promenadeImages	
</Location>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Where to place rewrite rules?

Posted by Eric Covener <co...@gmail.com>.
On Sat, Mar 29, 2008 at 8:46 AM, Sam Carleton
<sc...@miltonstreet.com> wrote:
> Eric,
>
>  When I do the following, the rewrite rules don't seem to work.  Where
>  should I be placing the rewrite rules and what settings should I have
>  for AllowOverride to stop it from looking for the .htaccess?

RewriteRules need to be in the proper virtual host, AllowOverride none
prevents apache from looking for .htaccess files

When you pull your rules out of Directory/htaccess,  the URL you're
testing against changes (the per-directory component hasn't been
stripped out -- now it always starts with a slash)

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Where to place rewrite rules?

Posted by Sam Carleton <sc...@miltonstreet.com>.
Eric,

When I do the following, the rewrite rules don't seem to work.  Where
should I be placing the rewrite rules and what settings should I have
for AllowOverride to stop it from looking for the .htaccess?

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Satisfy all
</Directory>
<Directory "D:/MSDev/PhotoParata/httpd/htdocs">
	Options SymLinksIfOwnerMatch
    AllowOverride all
    Order allow,deny
    Allow from all
    PhotoParataCfg conf/PhotoParata.conf
</Directory>

RewriteEngine On
RewriteRule ^images/([^/]+)/([^/]+)$ theImage?fldoid=$1&imgoid=$2 [L]
RewriteRule ^images/([^/]+)/([^/]+)/([^/]+)$
theImage?fldoid=$1&imgoid=$2&tn=$3 [L]
RewriteRule ^category/([^/]+)$ index.php?fldoid=$1 [L]
RewriteRule ^category/([^/]+)/i/([^/]+)$ index.php?fldoid=$1&imgoid=$2 [L]
RewriteRule ^category/([^/]+)/p/([\d]*)$ index.php?fldoid=$1&p=$2 [L]

Re: [users@httpd] Where to place rewrite rules?

Posted by Eric Covener <co...@gmail.com>.
On Fri, Mar 28, 2008 at 11:42 PM, Sam Carleton
<sc...@miltonstreet.com> wrote:
>  In analyzing my customers log file from running Filemon (Windows tool
>  to log file IO), it looks like Apache is trying to find the URL before
>  the RewriteRules are running.  Is this normal?  If not, do I have my
>  rewrite rules in the right place?

>  <Directory "D:/MSDev/PhotoParata/httpd/htdocs">
>     AllowOverride all
>  </Directory>

Is it looking for htaccess?

Probably better to keep your rewriterules outside of htaccess or <Directory>.

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org