apache - Run PHP code from .htaccess? -


"postprint" itemprop = "text">

I pass the url to a PHP function of a value in a rewrite order and need to be retrieved whether the new To say is to say the destination should be? Is there a way to do this?

Thank you.

Update:

Thank you so far..I am still having trouble but I will show you my code:

< P> .htaccess

  # I got the file path by echoing DOCUMENT_ROOT and the rest have been added RewriteMap fixurl PRG: /var/www/vhosts/mydomain.com/httpsdocs/domain_prototype on RewriteRule /code_base/url_handler.php RewriteEngine $ {fixurl: $ 1} (*.) [PT]  

PHP:

  set_time_limit (0); # Forever program! $ Keyboard = fopen ("php: // stdin", "r"); While (1) {$ line = trim (fgets ($ keyboard)); Print "www.google.com \ n"; # & Lt; - Test to see what works. }  

Although I'm getting a 500 internal server error , I'm not sure whether there is any error in my .htaccess or in my PHP?

There is something called a RewriteMap.

You can call an execution script URL will return

For more information and examples (in Perl, but completely applicable to any other language) this article Check:

A summary of warnings

  • Must read the taught STDIN loop (i.e., do not exit after receiving a URL )
  • The URL should be rewritten with a previous new line
  • Readable and user Apache Runs in the form should be executable by

This route map is

  to create RewriteMap fixurl PRG: / usr / local / scripts / fixit Php  

and now we can use it in a RewriteRule: (*.)

  RewriteRule RewriteEngine running $ {fixurl: $ 1}  

Edit: rror about internal server e The most likely reason is that what Gambo is mentioned, the Rivetmap can not be used in .htaccess, sadly. You can use it in .htaccess in a RewriteRule, but it can only be created in server config or virtual host config. To be sure, check the error log.

In this way, only the PHP / .htaccess solution will be to rewrite everything in a certain PHP program which checks and redirects using the location header. Something like: (. *)?

  RewriteRule proxy.php arg = $ 1 [QSA]  

Then, in proxy.php

  & lt ;; Php $ url = get_proper_destination ($ QUERY_STRING); #args will have a URI path, #and through QSA, you have # original query string header ("location: $ url"); ? & Gt;  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -