New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Nginx rewrite help
aldothetroll
Member
I want http://exampleurl.com/location/examplefile.php to become http://exampleurl.com/location/examplefile
This works but it rewrites everything including CSS / JS urls etc. so the site doesn't load properly.
rewrite ^/location/(.*)$ /location/$1.php last;
Can someone help me please?
Comments
try_files $uri $uri/ $uri.php;
Does not work. Updated the OP hopefully it gives more insight on what I'm looking for.
The problem is the browser thinks the document root is /location/examplefile/ which is not.
So as a fix when you are loading JS or CSS in the script tag use /path/to/js instead or path/to/js
Note: the / in the front
Or try html base tag
After more tweaking this finally works. Thank you all for your help.