Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to write nginx rewrite rules for clean URLs.

Everytime the user hits;

http://domain.com/abc/12/16/abc-def-ghi

I need to execute

domain.com/abc.php?a=12&b=16&c=abc-def-ghi

Now my regex is right as per rubular:

^\/abc\/(\d+)\/(\d+)\/(\w+\S+)$

http://rubular.com/regexes/11063

and rule is

if (!-e $request_filename) {
  rewrite ^\/abc\/(\d+)\/(\d+)\/(\w+\S+)$ abc.php?a=$1&b=$2&c=$3 last;
}

But it is giving "No input File specified". I cant find what the problem is?

share|improve this question
    
Do it the easy way! Get a .htaccess example, and convert it here: anilcetin.com –  matrixdevuk Mar 18 at 2:06
add comment

1 Answer

"No input File specified" error is coming form php-handler. This means rewrite rule is working fine but some other line is not prefixing proper base_dir.

Try this...

Replace

rewrite ^\/abc\/(\d+)\/(\d+)\/(\w+\S+)$ abc.php?a=$1&b=$2&c=$3 last;

With

rewrite ^\/abc\/(\d+)\/(\d+)\/(\w+\S+)$ /abc.php?a=$1&b=$2&c=$3 last;

Please note / (slash) before abc.php in above line.

Also problem can be...

  1. In location ~ \.php$ {} block. I hope u have one for sure in your full config :-)
  2. There must be a line like - root /var/www/exmaple.com; in your config. If its in location \ {..} block, you may need to copy it to the location ~ \.php$ {} or move outside location \ {..} but inside server {..} block.

If you can paste your nginx config here, it will be easier to debug. :-)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.