|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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: |
|
#2
|
|||
|
|||
|
>> 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 |
|
#3
|
|||
|
|||
|
Quote:
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. |
|
#4
|
|||
|
|||
|
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? |
|
#5
|
|||
|
|||
|
>> 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). |
![]() |
| Viewing: Dev Shed Forums > System Administration > Apache Development > mod_rewrite loading but not rewriting |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|