0

When you click to view a pdf file on a page the url is always this: http://yoursite.com/sites/default/files/myfile.pdf. You can modify this path in the field setting and add tokens, dates. But what if you wants the url to be simple and not give out the fact that this is a Drupal site. Can you change it to be this: http://yoursite.com/files/myfile.pdf. Does this require htaccess url rewrite or Apache redirects?

3
  • 1
    Ok sure, but this doesn't really obscure the fact that it is a Drupal site.
    – Kevin
    Apr 26, 2018 at 17:01
  • No but that is one flag that it is a Drupal site. Our client really just wants a simple url path. Apr 27, 2018 at 14:12
  • The biggest giveaway is any page that uses drupalSettings library, in the browser console you can type Drupal.settings and see the object, heh. There are various ways.
    – Kevin
    Apr 27, 2018 at 20:23

1 Answer 1

2

Go to this path /admin/config/media/file-system, and change the public file system path.

It might be this, sites/default/files, change it to files.

Then create a writeable folder in your webroot called files.

This could also be done by adding this line in the settings.php file:

$settings['file_public_path'] = 'files';

Just note that this is only for local development if you want to deploy this change you might use the above solution and then export the configuration.

4
  • Thanks! I opened the settings.php and added this- $settings['file_public_path'] = 'files'; Apr 27, 2018 at 13:35
  • Nice, you just need to remember that the changes you make in the settings file will not de deployed. If you want this change to be deployed, then you my solution and then export configuration.
    – user72672
    Apr 27, 2018 at 17:42
  • I would like to be able to export this config, but how are changes in the the settings files exported, does a configuration file get created when you export?. We set are memory limit in the settings file. But we do this change right on the server in prod and dev. Apr 28, 2018 at 18:55
  • On a normal drupal setup the changes in the settings.php file is only for local use. Everything that needs to get imported to prod, either needs to be exported as configuration or set manually on the prod server. I hope that explains what you are asking.
    – user72672
    Apr 28, 2018 at 22:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.