Solved

Can I use mod_rewrite to do two things instead of one?

Posted on 2004-08-24
4
167 Views
Last Modified: 2010-03-04
I want to use mod_rewrite to
          1.  write enviromental vars to a DB (in background)
          2.  go to the requested page

Can this be done?  I know that this can be done with PGP and auto_prepend_file, but can this be done without PHP?

Thanks!
0
Comment
Question by:hankknight
  • 2
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
brozzis earned 500 total points
ID: 11891936

write in a DB thru mod_rewrite ? hopefully not.

this can be quite trivially accomplished thru a PHP/perl/shell/whatever CGI script,
and mod_rewrite can be used successfully to implement a system to redirect to your cgi script
that should redirect you to your final page.

If you are willing to write an apache module to accomplish this, I think this could be done quite easily,
but I can't imagine such an hack to write something in a DB with mod_rewrite...




0
 
LVL 16

Author Comment

by:hankknight
ID: 11898721
Thanks!

If I understand you correctly, you are suggesting two ways to write every request to a DB:

1.  Use mod_rewrite to redirect everything to a script.  The script would write to the database AND send the requested document/file to the browser

2.  Create a custom Apache Mod from scratch

Is this corrrect?
0
 
LVL 2

Expert Comment

by:brozzis
ID: 11900066

Yes.

I don't know your needs, supposed loads, number of daily contacts, etc...
but having a db access for every page request could be a performance problem.
Keeping some session variables (cookies?) and writing just once on a DB per session could be a better choice.

There are already simple apache modules writing logging into mysql and postgreSQL DBs,
you could start from there.
0
 
LVL 16

Author Comment

by:hankknight
ID: 11901233
Thanks!

My logging/traffic stats package uses a DB and requries me to include a line that calls it in every page.
If I want it to log images and other non-dynamic pages, I have to use PHP for ALL file tyles and auto_append a PHP file.

I put the following in httpd.conf or .htaccess:

                ----------------------------------------------------
                ForceType application/x-httpd-php
                php_value auto_append_file "/home/webadmin/domain.com/html/log.php"
                ----------------------------------------------------

               where log.php writes to the DB.

I was hoping that a custom mod would improve performance, since the way I currently do it uses PHP even for images and wtill writes to the DB.

Maybe I should be looking for a logging script that doesn't use a Database.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Running Guacamole on port 80 5 212
XAMPP 3 60
SQL DRIVER FOR PHP / MSSQL 2008 Standard Edition (64-bit) SP4 (10.0.6000.29) 9 106
Clearing cache in word press. 3 58
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question