Dear Phantom,
thanks for your nice reply, according to your suggestion I have
adjusted the rules like:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.abc\.com$
RewriteCond %{REQUEST_URI} !^/index\.php$
RewriteCond %{REQUEST_URI} \.php$
RewriteCond %{QUERY_STRING} &?tid=(.+)&?
RewriteRule (.*)\.php$
http://www.abc.com$1/%1? [R]
</IfModule>
I'm glad to see, now the link already be referred to : from
www.abc.com/show.php?tid=1 to
www.abc.com/show/1, which is great.
But the 404 not found error still exists, here I attached the log:
[18/Feb/2008:22:20:15 +0800] [www.abc.com/sid#a01f538][rid#a17d938/
initial] (2) init rewrite engine with requested uri /show.php
[18/Feb/2008:22:20:15 +0800] [www.abc.com/sid#a01f538][rid#a17d938/
initial] (3) applying pattern '(.*)\.php$' to uri '/show.php'
[18/Feb/2008:22:20:15 +0800] [www.abc.com/sid#a01f538][rid#a17d938/
initial] (2) rewrite '/show.php' -> 'http://www.abc.com/show/177?'
[18/Feb/2008:22:20:15 +0800] [www.abc.com/sid#a01f538][rid#a17d938/
initial] (3) split uri=http://www.abc.com/show/177? -> uri=http://
www.abc.com/show/177, args=<none>
[18/Feb/2008:22:20:15 +0800] [www.abc.com/sid#a01f538][rid#a17d938/
initial] (2) explicitly forcing redirect with
http://www.abc.com/show/177
[18/Feb/2008:22:20:15 +0800] [www.abc.com/sid#a01f538][rid#a17d938/
initial] (1) escaping
http://www.abc.com/viewblog/177 for redirect
[18/Feb/2008:22:20:15 +0800] [www.abc.com/sid#a01f538][rid#a17d938/
initial] (1) redirect to
http://www.abc.com/show/177 [REDIRECT/302]
[18/Feb/2008:22:20:15 +0800] [www.abc.com/sid#a01f538][rid#a1cf638/
initial] (2) init rewrite engine with requested uri /show/177
[18/Feb/2008:22:20:15 +0800] [www.abc.com/sid#a01f538][rid#a1cf638/
initial] (3) applying pattern '(.*)\.php$' to uri '/show/177'
[18/Feb/2008:22:20:15 +0800] [www.abc.com/sid#a01f538][rid#a1cf638/
initial] (1) pass through /show/177
[18/Feb/2008:22:20:15 +0800] [www.abc.com/sid#a01f538][rid#a179928/
subreq] (2) init rewrite engine with requested uri /show/177
[18/Feb/2008:22:20:15 +0800] [www.abc.com/sid#a01f538][rid#a179928/
subreq] (1) pass through /show/177
[18/Feb/2008:22:20:15 +0800] [www.abc.com/sid#a01f538][rid#a1741b8/
initial/redir#1] (2) init rewrite engine with requested uri /
missing.htm
[18/Feb/2008:22:20:15 +0800] [www.abc.com/sid#a01f538][rid#a1741b8/
initial/redir#1] (3) applying pattern '(.*)\.php$' to uri '/
missing.htm'
[18/Feb/2008:22:20:15 +0800] [www.abc.com/sid#a01f538][rid#a1741b8/
initial/redir#1] (1) pass through /missing.htm
can anyone lend me a hand?
On 2ÔÂ18ÈÕ, ÉÏÎç5ʱ12·Ö, "phantom" <nob....DeleteThis@blueyonder.invalid> wrote:
> "freech" <hifre....DeleteThis@gmail.com> wrote in message
>
> news:5f0d23d6-58df-4c08-885b-824ac081d049@i29g2000prf.googlegroups.com...> hi guys, tried to make url rewrite like:
> >www.abc.com/show.php?tid=1intowww.abc.com/show/1
>
> > while encountered 404 error, please help:
>
> > <VirtualHost >
> > <IfModule mod_rewrite.c>
> > RewriteEngine On
> > RewriteCond %{HTTP_HOST} ^www.abc.com
>
> Host must start www<something>abc<something>com
> OK, but probably not quite what you meant, this maybe:
> RewriteCond %{HTTP_HOST} ^www\.abc\.com$
>
> > RewriteCond %{REQUEST_URI} !^index\.php$
>
> Always true, REQUEST_URI will *always* start with a slash, you probably
> wanted:
> RewriteCond %{REQUEST_URI} !^/index\.php$
>
> > RewriteCond %{REQUEST_URI} \.php$
> > RewriteRule (.*)\.php$http://www.abc.com$1[R]
>
> This rule will indeed rewrite
> /show.php tohttp://www.abc.com/show
> as you have not specified any query string in the right hand side, the
> original will be preserved, makinghttp://www.abc.com/show.php?tid=1->http://www.abc.com/show?tid=1
>
> Try adding
> RewriteCond %{QUERY_STRING} &?tid=(.+)&?
> and changing the rule to be:
> RewriteRule (.*)\.php$http://www.abc.com$1/%1?[R] >> Stay informed about: mod_rewrite returns 404 not found error