Moving Joomla from subdir to root -> rewrite / redirect problem

Johannes Rohr jorohr at gmail.com
Fri Dec 15 14:25:20 UTC 2017


Dear all,

in order to have prettier URLs I have decided to move my joomla from
/web/ to /, but I want old URLs to transparently redirect.

I am struggling how to do this.

First I though of something like

location /web {
  try_files $uri $uri/ /index.php?$args;
 }

but this obviously did not work as the arguments passed to index.php
still contain the /web/   part  , which would have to go.

So I tried instead:

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

thinking that the first line would modify the URI, taking away the /web/
part so that in the next line the changed uri would be fed to the
try_files command.

But this only resulted in 404s.

Can someone enlighten me on where I am going wrong with this?

Thanks a lot in advance,

Johannes

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20171215/061a2021/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 512 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20171215/061a2021/attachment.bin>


More information about the nginx mailing list