Bluehost.com Web Hosting $6.95

Help with Mod_Rewrite

This is a discussion on Help with Mod_Rewrite within the Linux Web Servers forums, part of the Web Server and Related Forums category; Does anyone know how to write correct rule for the following: redirect from: http://www.sample.com/index.php?any=...


Go Back   Usenet Forums > Web Server and Related Forums > Linux Web Servers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-28-2005
etizen@gmail.com
 
Posts: n/a
Default Help with Mod_Rewrite

Does anyone know how to write correct rule for the following:
redirect from:
http://www.sample.com/index.php?any=fixed&file=$AnyFileWithFullPath
redirect to: http://www.sample.com/redirected-$AnyFileWithFullPath

$AnyFileWithFullPath represents any url in my source codes.

For example,
If type in,
http://www.sample.com/index.php?any=...ter.php?id=new

that shoul invoke the following url:
http://www.sample.com/redirected-myu...ter.php?id=new

I would appreciate only if someone who knows for sure let me know how
to write one.

Many thanks in advance.

  #2 (permalink)  
Old 10-28-2005
Tim
 
Posts: n/a
Default Re: Help with Mod_Rewrite

RewriteRule ^/index.php?any=fixed&file=(.*) /redirected-$1

T.

  #3 (permalink)  
Old 10-29-2005
etizen@gmail.com
 
Posts: n/a
Default Re: Help with Mod_Rewrite


Tim wrote:
> RewriteRule ^/index.php?any=fixed&file=(.*) /redirected-$1
>
> T.


Thanks for your reply.

Unfortunately, it does not work.
Can anyone else help?

Thanks.

  #4 (permalink)  
Old 10-31-2005
spam@steve.org.uk
 
Posts: n/a
Default Re: Help with Mod_Rewrite

etizen@gmail.com wrote:
> Tim wrote:
> > RewriteRule ^/index.php?any=fixed&file=(.*) /redirected-$1
> >
> > T.

>
> Thanks for your reply.
>
> Unfortunately, it does not work.
> Can anyone else help?


"It does not work" is not a useful incentive to anybody else wishing to
help you.

Where did you put the rule? What didn't work? The rule as written
seems good.

What did your mod_rewrite debug log show? (You did debug this right?)

Steve
--
Debian GNU/Linux System Administration
http://www.debian-administration.org/

  #5 (permalink)  
Old 10-31-2005
etizen@gmail.com
 
Posts: n/a
Default Re: Help with Mod_Rewrite

It almost worked when coded as follows:
RewriteRule ^redirected-(.*) index.php?any=fixed&file=$1

The problem is all image files and other reference files are not
relatively redirected.
They should be read from the original path /.
However, the browser tries to read them from the new redirected
location:
redirected-(.*)

Is there any way to map those files as well?

Many thanks.




etizen@gmail.com wrote:
> Tim wrote:
> > RewriteRule ^/index.php?any=fixed&file=(.*) /redirected-$1
> >
> > T.

>
> Thanks for your reply.
>
> Unfortunately, it does not work.
> Can anyone else help?
>
> Thanks.


  #6 (permalink)  
Old 11-01-2005
netporter@gmail.com
 
Posts: n/a
Default Re: Help with Mod_Rewrite


Sorry if the tone offended you somehow.
My intention is not to be rude, not to be offensive, but to be friendly
and freely exchanging ideas.

Well, the way I wanted it to be is as follows:
RewriteRule ^redirected-(.*) index.php?any=fixed&file=$1

The problem is log file shows that the browser tries to read image
files and other html files from the following location:
redirected-(.*)

I want them to be read from:
index.php?any=fixed&file=$1

Can this be achieved?

Many thanks, again.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 05:54 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0