Solved

Rewrite rule for script?

Posted on 2004-10-11
11
462 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
Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now