.htaccess - nginx rewrite php file to another php file -


i've found ton of resources on online nothing of i've tried seems work.

i have old url gets called looks this:

http://domain.com/forum/index.php?app=subscriptions&r_f_g=xxx-paypal

xxx changes every time.

whenever page hit want use domain.com/index.php instead.

note don't want redirect, want request uri stay same, want php script @ root run, php script being called not exist.

my experiments have far been just

http://domain.com/forum/index.php

but ideally want working variables well. reason examples below don't include them because can't basic index.php working , fiddling variables overcomplicates things.

this i've tried far based on googling. none of them anything, return "404 not found" when access "forum/index.php"

location /forum/index.php {     rewrite ^ /index.php last; } 

alias ^/forum/index.php$ /; 

location /forum/index.php {     alias /index.php; } 

location ^(.*)$ {     try_files $uri $uri/ /index.php?$1; } 

i don't know else try , don't know why none these work. ideally want doesn't exist rewritten index.php, right that's kind of not important want 1 forum/index.php far haven't had luck.

can point me in right direction?

to recap:

q: when hits /forum/index.php want use /index.php not want redirect.

you mean want internal redirect instead of external redirect.

i had kind of issue too. how fixed it:

location / {   error_page 556 = @rewrite;   try_files $uri $uri/ =556; }  location @rewrite {   rewrite ^/(.*)$ /index.php?$1&$args last; } 

this quick & dirty. maybe knows nginx better knows better solution this. works me nontheless.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -