0

I have a Wordpress Network site 3.8+ where one of my sites is domain.com/media/.

On the root of domain.com, I am wanting to create a folder named "media" to store all uploads. Currently I have this folder as set up as above "media" with the site domain.com/media/ and nothing significant has happened.

However it might clash when I start adding content. Does anyone know if I can have the same foldername as a site name?

1

By default, yes, you will have conflicts. The default WordPress .htaccess rules look something like this:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

The -f and -d in those lines are important here. They basically say that if the requested URL does not match up to a file or directory in the path, then to rewrite the url to the index.php file. The index.php file is the entry point for WordPress.

So if you request /media/ and the /media folder exists, then it will serve that directory instead of the main index.php file. Now, depending on other configurations elsewhere, this may or may not be fine. That directory could have no indexing on it and so the default fallback position would be the index.php anyway.

There are other possible conflicts as well, and in general it is best avoided. However, it can work as long as you're aware of the potential issue and don't use page names that can be mistaken for files in the media directory. Because existing files will win over WordPress with that set of rules.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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