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=...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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. |
|
|||
|
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/ |
|
|||
|
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. |
|
|||
|
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. |