Solved

Rewrite rule for script?

Posted on 2004-10-11
11
467 Views
Last Modified: 2010-03-04
Is it possible to do a redirect which redirects

http://www.sitename.tld/stats

to

http://another.server.tld/cgi-bin/awstats.pl?config=www.sitename.tld

I think you see what i want to do here?
0
Comment
Question by:j2
  • 5
  • 2
11 Comments
 
LVL 4

Expert Comment

by:kalosi
ID: 12286916
Sure,

RewriteEngine On
RewriteRule ^/stats$ http://another.server.tld/cgi-bin/awstats.pl?config=www.sitename.tld [R,L]

Eventually you could pass dynamically your host into the URL

RewriteRule ^/stats$ http://another.server.tld/cgi-bin/awstats.pl?config=%{SERVER_NAME}[R,L]

david
0
 
LVL 12

Author Comment

by:j2
ID: 12287749
Yes, it was dynamically i wanted to do it. Ill try it out tonight. Thanks!
0
 
LVL 12

Author Comment

by:j2
ID: 12312740
Hm, i did

RewriteRule ^/stats$ http://scooter.mupp.net/cgi-bin/awstats.pl?config=%{SERVER_NAME}[R,L]

And i get

[Thu Oct 14 23:18:20 2004] [error] [client 81.226.214.134] File does not exist: /var/www/www.tallaksen.net/stats/

And as you can see i seem to have the module

scooter:~# grep -i rewrite /etc/apache/httpd.conf
LoadModule rewrite_module /usr/lib/apache/1.3/mod_rewrite.so
RewriteRule ^/stats$ http://scooter.mupp.net/cgi-bin/awstats.pl?config=%{SERVER_NAME}[R,L]
scooter:~# ls /usr/lib/apache/1.3/mod_r
mod_rewrite.so  mod_roaming.so

And i did restart the server.
0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
LVL 12

Author Comment

by:j2
ID: 12312796
Ok, i modified it abit
scooter:/var/log# grep -i rewrite /etc/apache/httpd.conf
LoadModule rewrite_module /usr/lib/apache/1.3/mod_rewrite.so
RewriteEngine On
RewriteLog /var/log/server.rewrite.txt
RewriteLogLevel 1
RewriteRule ^/stats$ http://scooter.mupp.net/cgi-bin/awstats.pl?config=%{SERVER_NAME}[R,L]
scooter:/var/log#

Still no go, and nothing in the log.
0
 
LVL 4

Accepted Solution

by:
kalosi earned 50 total points
ID: 12348180
AS you pasted the rule there is no space between {SERVER_NAME}[R,L]

the flags (in the [] brackets) must be separated from the rule with a whitespace (space, tab ....)

david
0
 
LVL 12

Author Comment

by:j2
ID: 12348854
Ah, i just copied your original code. Will try tomorrow! Thanks!
0
 
LVL 12

Author Comment

by:j2
ID: 12633243
What is going on here? This is the third question in a short while that has been forced to accept. Yet, i KNOW i have accepted answers fr them previously? And yes, the answer was indeed correct.

Kalosi: Sorry for the screwup. Not sure whats happened here. Thanks for the help.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

733 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