Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Below is a much simplified version of what I have in the configuration file of a server run by Nginx 1.2.5, yet it causes 301 Moved Permanently with Location: http://example.com/phpmyadmin/ before serving data, which is not what I expected from the default behavior of the rewrite directive.

server {
    listen 80;
    location /pma {
        rewrite ^ /phpmyadmin;
    location /phpmyadmin {
        root /var/www;
        index Documentation.html;

(Again, the example is highly simplified and altered, the config makes perfect sense in its original form.)

When I go to http://example.com/pma in a browser, the data is served but the URL in the address bar changes to http://example.com/phpmyadmin/ while it was supposed to stay http://example.com/pma.

How do I avoid Nginx sending 301 Moved Permanently so that it doesn't expose the actual directory structure on my server?

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.