SunQuest
           Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old July 23rd, 2001, 05:46 AM
forefront forefront is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Posts: 165 forefront User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 55 m 52 sec
Reputation Power: 9
mod_rewrite loading but not rewriting

http://www.foo.com/server-info/

Reports (see foot of message).

After trying mod_rewrite rules that I know work on many other servers and nothing happening on this one, I used the simple test rule from Apache (http://httpd.apache.org/docs/misc/rewriteguide.html
) of:

RewriteEngine on
RewriteRule ^/~(.+) http://www.otherdomain.com/~$1 [R,L]


Again, nothing happens. No rewrites, no redirections...

There is nothing in the server log files indicating anything is taking place or foobaqrring.

How can I ascertain what the cause of the problem is?

Thank you.



Server Version: Apache/1.3.12 OpenSSL/0.9.5a (Unix)
Server Built: Apr 5 2001 11:15:36
API Version: 19990320:7
Run Mode: standalone
User/Group: username(16861)/100
Hostname/port: www.foo.com:0
Daemons: start: 6 min idle: 6 max idle: 9 max: 20
VirtualHosts: current: 3 max: 25
Max Requests: per child: 500 keep alive: on max per connection: 20
Threads: per child: 0
Excess requests: per child: 0
Timeouts: connection: 300 keep-alive: 5
Server Root: /usr/local/etc/httpd
Config File: conf/httpd.conf
PID File: logs/httpd.pid
Scoreboard File: logs/apache_runtime_status

--------------------------------------------------------------------------------

Module Name: mod_rewrite.c
Content handlers: redirect-handler
Configuration Phase Participation: Child Init, Create Directory Config, Merge Directory Configs, Create Server Config, Merge Server Configs
Request Phase Participation: Translate Path, Check Type, Fixups
Module Directives:
RewriteEngine - On or Off to enable or disable (default) the whole rewriting engine
RewriteOptions - List of option strings to set
RewriteBase - the base URL of the per-directory context
RewriteCond - an input string and a to be applied regexp-pattern
RewriteRule - an URL-applied regexp-pattern and a substitution URL
RewriteMap - a mapname and a filename
RewriteLock - the filename of a lockfile used for inter-process synchronization
RewriteLog - the filename of the rewriting logfile
RewriteLogLevel - the level of the rewriting logfile verbosity (0=none, 1=std, .., 9=max)
Current Configuration:

Reply With Quote
  #2  
Old July 23rd, 2001, 06:07 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> RewriteEngine on
>> RewriteRule ^/~(.+) http://www.otherdomain.com/~$1 [R,L]

Tell us what are you trying to do exactly. And what did you type to the location bar?

>> There is nothing in the server log files indicating anything is taking place or foobaqrring

For mod_rewrite debugging, always add the following to your httpd.conf and define it globally.
It will log all mod_rewrite activities (default, userdir and vhosts).

RewriteEngine on
RewriteLog "/var/log/apache/rewrite_log"
RewriteLogLevel 9

Reply With Quote
  #3  
Old July 23rd, 2001, 06:29 AM
forefront forefront is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Posts: 165 forefront User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 55 m 52 sec
Reputation Power: 9
Quote:
Originally posted by freebsd

Tell us what are you trying to do exactly. And what did you type to the location bar?


As per our threads of last year - the following rewrite rule:

<Directory /usr/home/username/usr/local/etc/httpd/vhosts/domain.com/htdocs>
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/(cgi-bin)/?.*$
RewriteRule ^(.+) - [L]
RewriteRule ^([A-Za-z0-9_]+)/?$ index.php?category=$1 [T=application/x-httpd-php,L]
RewriteRule ^([A-Za-z0-9_]+)/([A-Za-z0-9_]+)/?$ index.php?category=$1&id=$2 [T=application/x-httpd-php,L]
</Directory>


I added RewriteLog and a "tail" of that reveals it is empty.

If I write www.foo.com/index.php?category=foo I should get a URI with /www.foo.com/foo/ (as with the other sites I have running this script/rewrite model) and the variables passed to index.php (and I guess something in the rewrite log) but nothing occurs.

Reply With Quote
  #4  
Old July 23rd, 2001, 06:51 AM
forefront forefront is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Posts: 165 forefront User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 55 m 52 sec
Reputation Power: 9
Now works but not on vhosts

ADDENDUM:

The rule works now on one domain which is the "main" (ServerName) domain of the account, but not on anything within any of the VHosts sections of the httpd.conf

What info. do you need to see why that is?

Reply With Quote
  #5  
Old July 23rd, 2001, 09:20 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> added RewriteLog and a "tail" of that reveals it is empty

If it's for a vhost, you need to add the lines in bold below:

RewriteEngine on
RewriteLog "/var/log/apache/rewrite_log"
RewriteLogLevel 9
...
<VirtualHost 123.45.67.89>
RewriteEngine on
RewriteOptions inherit
...
...
</VirtualHost>

>> If I write www.foo.com/index.php?category=foo I should get a URI with /www.foo.com/foo/

You first need to make sure you have disallowed Indexes to be overridden. Then set DirectoryIndex and give index.php the highest preference. If index.html has higher priority, requesting http://www.foo.com or http://www.foo.com/ will tell Apache to look for index.html first, if it exists, index.php will never be loaded, thus your mod_rewrite will never work as expected.
Anyhow, your case looks very similar to this -> http://forums.devshed.com/showthrea...8661&forumid=15 but I don't see why it's relevant to RewriteRule ^/~(.+) http://www.otherdomain.com/~$1 [R,L] as this one is external redirection and trying to map userdir to a remote site.

>> but not on anything within any of the VHosts sections of the httpd.conf

If you wanted all vhosts to do the same thing as your default, put the two lines:

RewriteEngine on
RewriteOptions inherit

within each <VirtualHost>. The position of the lines should be the very first followed by <VirtualHost> line (before ServerName and DocumentRoot and any others).

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > mod_rewrite loading but not rewriting


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway