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
Solved

Rewrite rule for script?

Posted on 2004-10-11
11
465 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
Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

 
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

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.

Question has a verified solution.

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

Suggested Solutions

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

839 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