Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Shells Virtual Desktop
BMail.ag - Secure Email Service
Server.net
CPLicense.net
VPS Server
Buy VPN
Vultr
VMs for AI
HostDare
ReliableSite White-Label Dedicated Hosting for Resellers
InterServer VPS
BMail.ag - Secure Email Service
Best VPN
High-Performance Bare Metal Server Solutions
Karvl.com
Server Mania Cloud Hosting
DataWagon Hosting
AlphaVPS Hosting
Evoxt.com
Clouvider
VPS Hosting with NVMe
Residential IPs in the US & 4G Mobile Proxies in EU & US with Unlimited Bandwidth
ReliableSite White-Label Dedicated Hosting for Resellers
Rabisu - Hosting Solutions
Shells Virtual Desktop
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.

Nginx rewrite help

aldothetrollaldothetroll Member
edited July 2014 in Help

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;

    Thanked by 2Boxode aldothetroll
  • @Rallias said:
    try_files $uri $uri/ $uri.php;

    Does not work. Updated the OP hopefully it gives more insight on what I'm looking for.

  • CloudconeCloudcone Member, Patron Provider

    rewrite ^/location/(.*)$ /location/$1.php last;

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

    Thanked by 1aldothetroll
  • MaTMaT Member

    Or try html base tag

    Thanked by 1aldothetroll
  • @Rallias said:
    try_files $uri $uri/ $uri.php;

    After more tweaking this finally works. Thank you all for your help.

Sign In or Register to comment.