redirect help please... this one's driving me mad!
Jason Woods
devel at jasonwoods.me.uk
Sat Mar 22 09:11:59 UTC 2014
On 22 Mar 2014, at 00.16, Francis Daly <francis at daoine.org> wrote:
> On Sat, Mar 22, 2014 at 11:37:38AM +1300, Steve Holdoway wrote:
>
> Hi there,
>
>> Sadly not one mention of the correct way to handle %1 and $1 in either
>> of these pages.
>
I seem to be having problems sending to this mailing list... but I will try again. Following is my response from a few days ago.
(The ^$ I remember as a weird one. REQUEST_URI is "/" if in httpd.conf. But if you are within .htaccess it trims the directory path, so at the webroot the REQUEST_URI is empty string, "".)
======
Assuming I understand what those rules are trying to do, maybe something along these lines? (needs testing)
location = / {
rewrite ^ /home;
}
location / {
if ($http_host ~* ^(?:www\.)?([^\.]*)\..*$) {
try_files $uri $uri/ /index.php?q=/_$1%$request_uri;
}
}
Then a regular \.php$ handler which returns 404 if the script doesn't exist and passes to fastcgi if it does.
Jason
More information about the nginx
mailing list