Solved

Rewrite rule for script?

Posted on 2004-10-11
11
463 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
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 video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

911 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

19 Experts available now in Live!

Get 1:1 Help Now