| Author |
mod_rewrite problem
|
|
|
| Hello,
..htaccess looks like this:
RewriteEngine On
RewriteRule ^zapisz/([0-9][0-9])/$ zapisz.php?id=$1
zapisz.php looks like this:
echo $_REQUEST['id']. '<br>!';
both files are in:
C:\usr\krasnal\www\Document
URL looks like this
http://127.0.0.1/~Document/zapisz/k2
zapisz.php echoes just this:
<br>!
What is wrong? I know this serv supports mod_rewrite because this works:
C:\usr\krasnal\www\Test\Rewrite\.htaccess looks like this:
RewriteEngine on
RewriteCond %{REQUEST_URI} \/index.html$
RewriteRule ^(.*) /~Test/rewrite/
C:\usr\krasnal\www\Test\Rewrite\index.php looks like this:
$adres_tab = explode ( "/", $_SERVER["REQUEST_URI"]) ;
echo "Zmienna 1: $adres_tab[1]<br>";
echo "Zmienna 3: $adres_tab[3]<br>";
URL looks like this:
http://127.0.0.1/~test/rewrite/88/88/index.html
Output:
Zmienna 1: ~test
Zmienna 3: 88
Regards,
Talthen
| |
| Jim Hayter 2006-07-20, 1:28 pm |
| talthen.z-serwera.o2@nospam.pl wrote:
> Hello,
>
> ..htaccess looks like this:
> RewriteEngine On
> RewriteRule ^zapisz/([0-9][0-9])/$ zapisz.php?id=$1
Note that the above pattern does not match zapisz/k2 as k is not a digit
in the range 0-9.
>
> zapisz.php looks like this:
> echo $_REQUEST['id']. '<br>!';
>
> both files are in:
> C:\usr\krasnal\www\Document
>
> URL looks like this
> http://127.0.0.1/~Document/zapisz/k2
>
> zapisz.php echoes just this:
> <br>!
>
> What is wrong? I know this serv supports mod_rewrite because this works:
> C:\usr\krasnal\www\Test\Rewrite\.htaccess looks like this:
> RewriteEngine on
> RewriteCond %{REQUEST_URI} \/index.html$
> RewriteRule ^(.*) /~Test/rewrite/
>
> C:\usr\krasnal\www\Test\Rewrite\index.php looks like this:
> $adres_tab = explode ( "/", $_SERVER["REQUEST_URI"]) ;
> echo "Zmienna 1: $adres_tab[1]<br>";
> echo "Zmienna 3: $adres_tab[3]<br>";
>
> URL looks like this:
> http://127.0.0.1/~test/rewrite/88/88/index.html
>
> Output:
> Zmienna 1: ~test
> Zmienna 3: 88
>
>
> Regards,
> Talthen
>
>
| |
|
| >> URL looks like this
[vbcol=seagreen]
[vbcol=seagreen]
> Note that the above pattern does not match zapisz/k2 as k is not a digit
> in the range 0-9.
Well... I dunno what that k does in my URL. It should be:
http://127.0.0.1/~Document/zapisz/2
which is also not working.
However http://localhost/server-info shows mod_rewrite.c, so it should
work!
Regards,
Talthen
| |
| Jim Hayter 2006-07-20, 1:28 pm |
| talthen.z-serwera.o2@nospam.pl wrote:
>
This pattern requires the string zapisz, a slash, a digit, a digit, a
slash. zapisz/2 does not match it either. If the number of digits is
one or more, try the pattern:
^zapisz/([0-9]+)/$
[vbcol=seagreen]
>
>
> Well... I dunno what that k does in my URL. It should be:
> http://127.0.0.1/~Document/zapisz/2
> which is also not working.
>
> However http://localhost/server-info shows mod_rewrite.c, so it should
> work!
>
> Regards,
> Talthen
>
>
| |
|
| >>>> ..htaccess looks like this:
>
> This pattern requires the string zapisz, a slash, a digit, a digit, a
> slash. zapisz/2 does not match it either.
http://127.0.0.1/~Document/1/zapisz/28/
But above doesn't mach either...
Regards,
Talthen
| |
| Jim Hayter 2006-07-20, 7:27 pm |
| talthen.z-serwera.o2@nospam.pl wrote:
>
> http://127.0.0.1/~Document/1/zapisz/28/
>
> But above doesn't mach either...
I'm not sure what you are saying here. Does the above URL work? If so
I'm surprised as it doesn't match your pattern.
Have you considered setting the RewriteLogLevel to non-zero and
examining the rewrite log? It should prove informative.
| |
| Ulrich Schöbel 2006-07-20, 7:27 pm |
| Am Thu, 20 Jul 2006 20:55:48 +0200 schrieb talthen.z-serwera.o2:
>
> http://127.0.0.1/~Document/1/zapisz/28/
>
> But above doesn't mach either...
>
> Regards,
> Talthen
Hi Talthen,
Don't anchor the expression and will work:
RewriteRule zapisz/([0-9][0-9])/$ zapisz.php?id=$1
Kind regards
Ulrich
| |
|
| > RewriteRule zapisz/([0-9][0-9])/$ zapisz.php?id=$1
It is not working.
Regards,
Talthen
| |
|
|
|
|
|
| > Have you considered setting the RewriteLogLevel to non-zero and examining
> the rewrite log? It should prove informative.
Where should I set it? I don't see "RewriteLogLevel" in .httpd.conf
Regards,
Talthen
| |
| Ulrich Schöbel 2006-07-21, 7:36 am |
| Am Fri, 21 Jul 2006 13:00:10 +0200 schrieb talthen.z-serwera.o2:
>
> http://127.0.0.1/~Document/1/zapisz.php?id=28
> echoes: 28<br>!
> http://127.0.0.1/~Document/1/zapisz/28/
> echoes: <br>!
>
> And I want both to echo 28<br>!
> Regards,
> Talthen
That's what I said, the rule is not what you want!
Try this one:
RewriteRule ^(.*)/zapisz/([0-9][0-9])/$ $1/zapisz.php?id=$2
Regards
Ulrich
| |
|
|
| frizzle 2006-07-22, 1:21 pm |
| talthen.z-serwera.o2@nospam.pl wrote:
>
> I put that:
> RewriteEngine On
> RewriteRule ^(.*)/zapisz/([0-9][0-9])/$ $1/zapisz.php?id=$2
> into files:
> http://127.0.0.1/~Document/1/.htaccess
> http://127.0.0.1/~Document/.htaccess
>
> Still echoeing just "<br>!" with no ID...
>
> Regards,
> Talthen
How about
RewriteEngine On
RewriteBase /
RewriteRule ^zapisz/([0-9]{2}(/)?)$ zapisz.php?id=$1
Wouldn't require a trailing slash, but would accept it.
Frizzle.
|
|
|
|