You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Ian Munday <ia...@illumen.co.uk> on 2008/06/19 16:01:18 UTC

[users@httpd] Redirect a old dynamic URL to a new dynamic URL

Hi,

I'm using Apache 2.2.3 on Debian.

I'm trying to redirect a number of URLs that were generated by an old  
content management system to those generated by a new content  
management system.  The parameter values do not map directly, so I  
simply intend to explicitly redirect the old style URL to the new  
style URL.

I'm using the .htaccess file and can get it to correct redirect a rule  
such as:

     Redirect 301 /product1.html http://www.domain.com/index.php?page=shop.browse&category_id=28&option=com_virtuemart&Itemid=32

However, using the old URLs with parameters does not work.  I wonder  
if this is a character escape issue, and have tried a few variations  
but have had no joy.  As an example, what I am trying to do, but that  
does not work, is:

     Redirect 301 /index.php?main_page=index&cPath=28 http://www.domain.com/index.php?page=shop.browse&category_id=28&option=com_virtuemart&Itemid=36
     Redirect 301 /index.php?main_page=index&cPath=57 http://www.domain.com/index.php?page=shop.browse&category_id=57&option=com_virtuemart&Itemid=36

I'd be grateful for any pointers.

Regards,

Ian

Re: [users@httpd] Redirect a old dynamic URL to a new dynamic URL

Posted by Ian Munday <ia...@illumen.co.uk>.
Hi Nick,

Thanks for your response.

On 19 Jun 2008, at 17:25, Nick Kew wrote:

> On Thu, 19 Jun 2008 15:01:18 +0100
> Ian Munday <ia...@illumen.co.uk> wrote:
>
>> I'm using the .htaccess file
>
> Ouch!  That makes for slow and complex.

Is there a better way then?


>> However, using the old URLs with parameters does not work.  I  
>> wonder if this is a character escape issue, and have tried a few  
>> variations but have had no joy.  As an example, what I am trying to  
>> do, but that does not work, is:
>>
>>     Redirect 301 /index.php?main_page=index&cPath=28 http://www.domain.com/index.php?page=shop.browse&category_id=28&option=com_virtuemart&Itemid=36
>>     Redirect 301 /index.php?main_page=index&cPath=57 http://www.domain.com/index.php?page=shop.browse&category_id=57&option=com_virtuemart&Itemid=36
>
> Indeed, that's the point where you need RewriteRule rather than  
> Redirect[1].  If you have access to httpd.conf, you should also look  
> at RewriteMap.

Can you point me at some examples of RewriteRule for what I'm trying  
to do above.  I've looked at the documentation at http://httpd.apache.org/docs/2.0/misc/rewriteguide.html 
, but don't see an example of this nature.  Or am I missing something  
obvious?

Regards,

Ian

Re: [users@httpd] Redirect a old dynamic URL to a new dynamic URL

Posted by Nick Kew <ni...@webthing.com>.
On Thu, 19 Jun 2008 15:01:18 +0100
Ian Munday <ia...@illumen.co.uk> wrote:

> I'm using the .htaccess file

Ouch!  That makes for slow and complex.

> However, using the old URLs with parameters does not work.

Indeed, that's the point where you need RewriteRule rather than
Redirect[1].  If you have access to httpd.conf, you should also
look at RewriteMap.

[1] We get far more of the opposite: complex Rewrite setups
where a simple Redirect or Alias would work.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org