You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Chad Day <cd...@atpco.com> on 2002/12/03 19:24:59 UTC

[users@httpd] Mod_rewrite rule help..

I'm having a lot of trouble trying to get apache to even recognize this
rule, which I'm sure I wrote wrong.

I want requests that look like:


http://calendar.domain.com/user1
http://calendar.domain.com/user2
http://calendar.domain.com/user3

which would be 404 documents, to redirect to

http://calendar.domain.com/view.php?ID=user1
http://calendar.domain.com/view.php?ID=user2
http://calendar.domain.com/view.php?ID=user3

so I could pull up that user's calendar and display it.

The rule I had been fiddling with was:

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/([^/]+)/?$
RewriteCond /usr/local/www/sites/domain.com/htdocs/calendar/$1 !-d [NC]
RewriteRule /.* http://calendar.domain.com/view.php?ID=$1 [R,L]
RewriteEngine Off

I'm sure I screwed it up though.. nothing is appearing in the rewrite log
(and I have that defined earlier in the conf) .. can anyone help me out with
this?

Thanks,
Chad


---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Mod_rewrite rule help..

Posted by Joshua Slive <jo...@slive.ca>.
On Tue, 3 Dec 2002, Chad Day wrote:
> RewriteEngine on
> RewriteCond %{REQUEST_URI} ^/([^/]+)/?$
> RewriteCond /usr/local/www/sites/domain.com/htdocs/calendar/$1 !-d [NC]
> RewriteRule /.* http://calendar.domain.com/view.php?ID=$1 [R,L]
> RewriteEngine Off

Hmmm... You're the second person I've seen using RewriteEngine On ...
RewriteEngine off.  Where are people getting that idea?  The RewriteEngine
off is overridding the rewriteEngine On and making apache ignore all the
rewriterules.  Get rid of it.

Also, if you want there to be anything in the $1, you'll need to replace
"/.*" with "/(.*)".

Finally, if you want something in the rewrite log file (good idea!),
you'll want a RewriteLog and RewriteLogLevel directive.

Joshua.

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org