Re: Newbie - Is there a PHP equivalent of Server.Transfer (in ASP.NET)



On Aug 22, 2:38 am, Alan Silver <alan-sil...@xxxxxxxxxxxxxxxxxxxx>
wrote:

Sorry for the newbie question, but I've only been at PHP for a couple of
days, and I'm trying to get some stuff done as fast as possible. I'm an
experienced ASP.NET programmer, and am trying to find some equivalent
stuff in PHP.

In ASP.NET there is a method called Server.Transfer which transfers the
request to a different page from the one that the user requested, but
without doing a redirect. The user gets sent headers as though they were
seeing the page they requested.

Does PHP have such a function?

No. Server.Transfer is IIS' way of doing URL rewriting. PHP, being
originally developed for Apache, leaves URL rewriting to the HTTP
server. So what you need to do is to set up a rewrite rule. If you
are using Apache, you already have everything you need for that. If
you are using IIS, there are add-on modules that allow you to do URL
rewriting. I use ISAPI_Rewrite on one of my development servers:

http://www.isapirewrite.com/

From your later message, I understand you are using WordPress.
WordPress' .htaccess file is not very complicated; it basically boils
down to this:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

and the above in all likelihood can be ported over to ISAPI_Rewrite.

Cheers,
NC

.



Relevant Pages

  • Re: WANTED: need a real web API for rubyforge.org
    ... would be independent of the GForge code. ... with a nice ActiveRecord model and a RESTful API and all that... ... And I don't know, when I think about rewriting it, I ... start thinking that I should just read my PHP books and make any changes ...
    (comp.lang.ruby)
  • Re: [SLE] PHP5 ??
    ... Since they changed the language AGAIN, you'll have headaches ... > rewriting your code to work with it. ... I have an application I wrote for PHP that works perfectly without any changes ...
    (SuSE)
  • Re: PHP/MySQL oddity
    ... (PHP 5.2, MySQL 5). ... text without rewriting the entire thing. ... Or echo the whole thing, or double quotes around the variable. ...
    (comp.lang.php)
  • Re: PHP adds hidden value
    ... This is because you are using sessions, and PHP is automatically ... If you want to remove the rewriting, ... show this strange behaviour. ...
    (comp.lang.php)
  • Re: httpHandlers
    ... We are only rewriting URLs with aspx extensions e.g. ... "normal" request that needs to be rewritten. ... identfy this as a call to a handler. ...
    (microsoft.public.dotnet.framework.aspnet)