Solved

Rewrite rule for script?

Posted on 2004-10-11
11
470 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
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…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

717 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