|
Home > Archive > Apache Server configuration support > November 2004 > Rewrite Problem
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Philippe MILS 2004-11-29, 5:57 pm |
| I would like to do the following simple thing:
if the following URL is send by a navigator: www.mywebsite.com/index.php I
would like this to be replaced by
www.mywebsite.com/index.php?option=...d=30&Itemid=59.
if a URL which has the form
www.mywebsite.com/index.php?option=...&otherparmaters is sent to
the server, I do not want the URL to be rewriten.
That should be very simple.
However in one day work I did not find yet the solution.
Does anybody has an idea on how to do this?
What I tryed bellow just redirect ALL the URLs stating by index.php to
index.php?option=com_content&task=view&id=30&Itemid=59
---------------
RewriteEngine on
RewriteRule ^index\.php$
index.php?option=com_content&task=view&id=30&Itemid=59
--------------
Do not realy understand what is wrong in what I have made.
| |
| Thomas Mlynarczyk 2004-11-29, 5:57 pm |
| Also sprach Philippe MILS:
> I would like to do the following simple thing:
>
> if the following URL is send by a navigator:
> www.mywebsite.com/index.php I would like this to be replaced by
> www.mywebsite.com/index.php?option=...d=30&Itemid=59.
> if a URL which has the form
> www.mywebsite.com/index.php?option=...&otherparmaters is
> sent to the server, I do not want the URL to be rewriten.
>
> That should be very simple.
>
> However in one day work I did not find yet the solution.
>
> Does anybody has an idea on how to do this?
Not tested, but the following could give you an idea how to go about it:
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^index\.php$
index.php?option=com_content&task=view&id=30&Itemid=59
The above in English: "If the page requested is index.php and the query
string is empty, change it to this."
---------------
> RewriteEngine on
>
> RewriteRule ^index\.php$
> index.php?option=com_content&task=view&id=30&Itemid=59
> --------------
> Do not realy understand what is wrong in what I have made.
The query string is stripped of by mod_rewrite before it processes the
rules. If you want to test the query string you must use
RewriteCond %{QUERY_STRING} pattern_to_test
If you want the original query string to be re-appended to the changed URL,
use the [QSA] flag.
| |
| Philippe MILS 2004-11-30, 2:48 am |
| I tried what you suggested Thomas.
This works perfectly fine. Many thanks!
Philippe
"Thomas Mlynarczyk" <blue_elephant55@hotmail.com> a écrit dans le message de
news: cofpq8$acf$01$1@news.t-online.com...
> Also sprach Philippe MILS:
>
>
> Not tested, but the following could give you an idea how to go about it:
|
|
|
|
|