Need to remove folder name from URL

Francis Daly francis at daoine.org
Thu Feb 12 22:01:52 UTC 2015


On Thu, Feb 12, 2015 at 03:06:26AM -0500, strtwtsn wrote:

Hi there,

> We need the pages below folder_name to be accessible at
> example1.com/folder_name/page1 example1.com/folder_name/page2 etc

  location /folder_name/ { proxy_pass http://example.com; }

So when the user makes a request of nginx for /folder_name/page1,
nginx does proxy_pass to example.com/folder_name/page1 and returns the
content, yes?

> This is working apart from i've been asked to make the pages below
> folder_name accessible without the folder_name
> 
> So it would be example1.com/page1 example1.com/page2.  They will still be
> below the folder_name, but the folder name must not show in the address
> bar.

So when the user makes a request of nginx for /page1, nginx should do
proxy_pass to example.com/folder_name/page1 and return the content, yes?

If "no", what should nginx do when the user requests /page1?

> Hope this helps.

I think I still understand the same thing. And I do not understand where
the problem is.

  location / { proxy_pass http://example.com/folder_name/; }

and then presumably extra locations for the requests that should not be
handled by this proxy_pass mechanism.

What happened when you tried it?

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list