RE: mod_rewrite and mod_jk help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Allen for your reply.

in my setting, the /user/ has a home.jsp. if i access normally to
www.example.com/user/home.jsp it works (i've set in /etc/hosts to point
www.example.com to 127.0.0.1). the /user/ is in the tomcat, connected
via mod_jk.

now i change your sample rewrite rule abit to
RewriteRule ^/(.*?)/(.*)$ /user/$2?user=$1 [L]

When i tried to access http://www.example.com/me/home.jsp. i got the
following error in error_log

[error] [client 127.0.0.1] File does not exist: /var/www/html/me

Seems httpd ignore the rewrite rule and try to find the 'me' in the
root document directly.

Here's the config that relates to mod_rewrite, i don't user .htaccess:

/etc/httpd/conf/httpd.conf
<Directory "/var/www/html">
...
AllowOverride All
...
</Directory>

Is the above <Directory> setting correct? as /user/ is resides in my
tomcat, not in the httpd root document.


/etc/httpd/conf.d/url-rewrite.conf
RewriteEngine on
RewriteLog /var/log/httpd/rewrite.log
RewriteLogLevel 9

RewriteRule ^/(.*?)/(.*)$ /user/$2?user=$1 [L]



- Rony -




--- Allen Pulsifer <pulsifer3@xxxxxxxxxxx> wrote:

> > Now want when a user browse www.example.com/someusername/ 
> > httpd will forward the request to 
> > www.example.com/user/?user=someusername
> > 
> > And when browse a user browse 
> > www.example.com/someusername/login/ httpd will forward the 
> > request to www.example.com/user/login/?user=someusername
> > 
> > So just 'pull out' the 'someusername' and add 
> > ?user=someusername at the end. Is this doable?
> 
> By "forward the request", I assume you mean "respond as if the url
> were X",
> as opposed to "redirect the request to X via HTTP response code 301
> or 302."
> If so, try this:
> 
> RewriteRule ^/(.*?)/(.*)/$ /$2/?user=$1 [L]
> 
> Rewrite rules are notoriously difficult to debug.  Turning on rewrite
> logging and then trying truncated versions or simplified versions of
> the
> rule against various requests might help.  Good luck.
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
>    "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
> 
> 



 
____________________________________________________________________________________
The fish are biting. 
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux