0

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; break; } } 

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

I've this php code in my index.php:

if(preg_match('#([\w\.-]+)\.example\.com(.+)#', $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'], $match)) { header('Location: http://example.com/browse.php?u=http://'.$match[1].$match[2]); die; } 

But when requested a page with a .php extension I'll get a 404 not found error:

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 know why it's not working, on apache it's working fine.

Thanks in advance.

I've removed the location and now it's working perfectly:

if (!-e $request_filename) { rewrite ^(.*)$ /index.php last; break; } 

1 Answer 1

0

I could not fully understand your question. But, it looks like you may want to add try_files in your location block, something like this...

 location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php last; break; } try_files $uri =404; }

I hope this helps.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.