0

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?

1

1 Answer 1

1

"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. :-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .