You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by thomas Armstrong <ta...@gmail.com> on 2007/05/25 18:13:00 UTC

[users@httpd] Problem with htaccess (/year/month/day/)

 I'm trying to make my website works with http://www.domain.com/2007/05/25/foo
to server http://www.domain.com/redirect.php

With Apache 2.2, my .htaccess:
----------------------------
RewriteEngine On
RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+)/(.*) /redirect.php [QSA,L]
RewriteRule ^([0-9]+)/([0-9]+) /redirect.php [QSA,L]
----------------------------

If I type:
- http://www.mydomain.com/2007/05, it works
- http://www.mydomain.com/2007/05/25/foo, I get a 404 error message.

What am I doing wrong?

Thank you very much.

---------------------------------------------------------------------
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] Problem with htaccess (/year/month/day/)

Posted by Joshua Slive <jo...@slive.ca>.
On 5/28/07, thomas Armstrong <ta...@gmail.com> wrote:
> Yep, I agree it's better using RewriteRules within httpd.conf but...
> I'm not allowed with this server :(
>
> Is it possible to use RewriteLog within '.htaccess'?

I don't believe so. As I said, you'll need to replicate the setup on a
test server to debug.

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


Re: [users@httpd] Problem with htaccess (/year/month/day/)

Posted by thomas Armstrong <ta...@gmail.com>.
Yep, I agree it's better using RewriteRules within httpd.conf but...
I'm not allowed with this server :(

Is it possible to use RewriteLog within '.htaccess'?

Thank you very much for your answer.

On 5/26/07, Joshua Slive <jo...@slive.ca> wrote:
> On 5/25/07, thomas Armstrong <ta...@gmail.com> wrote:
> >  I'm trying to make my website works with http://www.domain.com/2007/05/25/foo
> > to server http://www.domain.com/redirect.php
> >
> > With Apache 2.2, my .htaccess:
> > ----------------------------
> > RewriteEngine On
> > RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+)/(.*) /redirect.php [QSA,L]
> > RewriteRule ^([0-9]+)/([0-9]+) /redirect.php [QSA,L]
> > ----------------------------
> >
> > If I type:
> > - http://www.mydomain.com/2007/05, it works
> > - http://www.mydomain.com/2007/05/25/foo, I get a 404 error message.
> >
> > What am I doing wrong?
>
> Not using the RewriteLog to debug your mod_rewrite config.
>
> Things go much easier in general if you put your mod_rewrite config in
> httpd.conf rather than .htaccess. If you don't have access to
> httpd.conf, then you should setup a test server on another machine to
> debug your rewrite stuff.
>
> (I don't see anything obviously wrong with your RewriteRules, but the
> RewriteLog will tell you what is really going on.)
>
> 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
>
>

---------------------------------------------------------------------
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] Problem with htaccess (/year/month/day/)

Posted by Joshua Slive <jo...@slive.ca>.
On 5/25/07, thomas Armstrong <ta...@gmail.com> wrote:
>  I'm trying to make my website works with http://www.domain.com/2007/05/25/foo
> to server http://www.domain.com/redirect.php
>
> With Apache 2.2, my .htaccess:
> ----------------------------
> RewriteEngine On
> RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+)/(.*) /redirect.php [QSA,L]
> RewriteRule ^([0-9]+)/([0-9]+) /redirect.php [QSA,L]
> ----------------------------
>
> If I type:
> - http://www.mydomain.com/2007/05, it works
> - http://www.mydomain.com/2007/05/25/foo, I get a 404 error message.
>
> What am I doing wrong?

Not using the RewriteLog to debug your mod_rewrite config.

Things go much easier in general if you put your mod_rewrite config in
httpd.conf rather than .htaccess. If you don't have access to
httpd.conf, then you should setup a test server on another machine to
debug your rewrite stuff.

(I don't see anything obviously wrong with your RewriteRules, but the
RewriteLog will tell you what is really going on.)

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