Jump to content

Nginx Rewrite - discard anything after '.php'


SteiniPe

Recommended Posts

The issue I am facing is a very simple one which I can not find a solution to. I can do it with an IF statement but it will still not work completely like I want it to, the code for IF is like this

 

if ( $request_filename ~ supporttickets.php ) { rewrite https://<sitegoeshere>/addonmodules.php?module=TicketDepartmentBoxes redirect; }

 

This will work so when you goto

 

Site.com/supporttickets.php => Site.com/addonmodules.php?module=TicketDepartmentBoxes

 

but what I do not want is

 

Site.com/supporttickets.php?view&id=X => Site.com/addonmodules.php?module=TicketDepartmentBoxes

 

If I can somehow isolate so it stops after .php and does not also read into ?view... then IF can work, I tried something like

 

location ~ /admin/supporttickets.php$ {

rewrite ^ /admin/addonmodules.php?module=TicketDepartmentBoxes redirect;

}

 

This doesn't work it will redirect the "Tickets awaiting reply" link to the module, but once you click the links in the module to goto supporttickets.php?action&view=id it grabs it AGAIN and reroutes to the same module index.

 

anyone have any clue how I can isolate the regexp so the URL will end at .php and not catch the link if it has variables appended to it in Nginx

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated