Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9125237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:45:28+00:00 2026-06-17T06:45:28+00:00

I have several basic redirects on apache using mod_rewrite’s RewriteRules. I want to do

  • 0

I have several basic redirects on apache using mod_rewrite’s RewriteRules.
I want to do these redirections programatically, using Zend Framework.
These redirections may include different domains.
E.g.

RewriteRule ^/xmas(.*) http://mycdn.com/things/xmas$1 [P]

When redirecting with Apache, the url stays the same, e.g. on the address bar on the browser. I want to mimic this behaviour in ZF, but cannot find the way for other domains.

I can do it for in-site redirections via extending Zend_Controller_Router_Route, extending the match() method, and then returning an array with module, controller, action, etc. fields.

class My_Route extends Zend_Controller_Router_Route
{
// ...

  public function match($path)
  {
    // ...
    return
      array(
        'module' => 'default',
        'controller' => 'mycontroller',
        'action' => 'index',
    );
  }
}

But I haven’t managed to make it work for redirecting to other domains, since it apparently only works for in-site routes (Haven´t found a way to specify domain or full url on the specs either).

I have tried another ways, like:

$r = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
$r->gotoUrl("http://otherdomain.com/some-stuff-to-redirect-to")->redirect();

and this does the redirection, but it totally changes the page making a whole new request.

How could I implement this in ZF?
Using ZF1.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:45:29+00:00Added an answer on June 17, 2026 at 6:45 am

    The [P] flag on mod_rewrite rules is a new one on me, but from the docs it looks like it tells Apache to proxy the request to the given URL (using mod_proxy). So it actually makes another request to that URL internally and serves it back to the user, it’s not a redirect. The equivalent in ZF would be to route the request to an action which uses Zend_Http_Client to make another request to the remote server.

    It can’t think of any situation in which this would be a good idea. The example you gave is rewriting a request to a remote CDN. By doing this you completely negate all the advantages of having a CDN in the first place (better performance, lower bandwidth costs). Perhaps if you can explain your use case there might be a better way to achieve what you are trying to do.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several entities with a basic Long ID and other properties. These entities
Using Installshield 2010 with a Basic MSI project. I have several config files that
I'm relatively new to SVN and have a rather basic question. I have several
I have a basic question. I would like to make running Arc.py several times
I have some code to create a basic dialog box with several options -
I have several xml files with different node structure. I want to extract xml
I have several C and C++ projects that all follow a basic structure I've
I have several WCF wsHttp services using Transport security over an SSL connection. Presently
Let's say I have a program made of several basic algorithms on integral variables,
I am currently using an older version of Umbraco (4.03) and I have several

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.