Welcome! Log In Create A New Profile


Rewrite PHP does not work

Posted by TonHoekstra 
Rewrite PHP does not work
June 21, 2012 08:35AM
I've a Suffix Proxy installed and I'm using the following rewrite with wildcard subdomain DNS on:
location / {
     if (!-e $request_filename) {
        rewrite ^(.*)$ /index.php last;

My suffix proxy has the following URL format:
(subdomain and/or domain + domain extension to proxy).proxy.org/(request-uri)

But when requested a page with a .php extension I'll get a 404 not found error. Example:
http://www.php.net.proxy.org/docs.php - HTTP/1.1 404 Not Found
http://www.utexas.edu.proxy.org/learn/php/ex3.php - HTTP/1.1 404 Not Found

But everything else is working (also index.php is working):
http://php.net.proxy.org/index.php - HTTP/1.1 200 OK
http://www.php-scripts.com.proxy.org/php_diary/example2.php3 - HTTP/1.1 200 OK
http://www.utexas.edu.proxy.org/learn/php/ex3.phps - HTTP/1.1 200 OK
http://www.w3schools.com.proxy.org/html/default.asp - HTTP/1.1 200 OK

Somebody has an answer? I don't why it's not working on apache it's working fine.

Thanks in advance.
Re: Rewrite PHP does not work
June 21, 2012 09:05AM
"If is evil"... use "try_files" instead.

try_files $uri $uri/ /index.php;
Re: Rewrite PHP does not work
June 21, 2012 09:45AM
Wolfsrudel Wrote:
> "If is evil"... use "try_files" instead.
> try_files $uri $uri/ /index.php;

I've tried that but everything after the / (the request-uri) is 404.

http://www.google.com.proxy.org - HTTP/1.1 200 OK (but the css and logo is not working)
http://www.google.com.proxy.org/imghp - HTTP/1.1 404 Not Found
Re: Rewrite PHP does not work
June 22, 2012 04:20AM
I've removed the location and now it's working perfectly:
if (!-e $request_filename) {
     rewrite ^(.*)$ /index.php last;
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 93
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready