PsychoX
PsychoX

Reputation: 1098

Move folder outside doc root

I'm trying to move my (wordpress) wp-contents directory outside wordpress site root folder.

WP path: /home/me/domains/my_domain/public_html/
Target wp-contents directory: /home/me/domains/stuff/

I'm experimenting with htaccess without success...

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/wp-content(/*)
RewriteRule ^wp-content/(.*)$ /../../stuff/wp-content/$1 [L]

Any ideas?

Upvotes: 0

Views: 506

Answers (1)

Pekka
Pekka

Reputation: 449525

This is not possible within .htaccess - you'll need to define the Rewrite condition directly in the server's configuration in order to be able to specify directories outside the web root.

The easiest workaround, if you can create them, is using a symbolic link instead. If you do, you may need to add

Options +FollowSymlinks

to your .htaccess or Apache configuration.

Upvotes: 2

Related Questions