Page 1 of 1

User login with Mod_Rewrite and a common folder? Possible

PostPosted: 24. December 2021 14:35
by Richard Marell
I am using mod_rewrite to forward a user to its own folder based on username:

<Directory "${SITEROOT}/login">
AuthName "Restricted Area"
AuthType Basic
AuthUserFile xxxxxxx/.htpasswd
AuthGroupFile /dev/null
require valid-user
RewriteEngine On
RewriteCond %{REQUEST_URI} !/users/.+/
RewriteCond %{REMOTE_USER} (.+)
RewriteRule (.*) /users/%1/$1 [L]
</Directory>

Every user has his own index.html and basically loads his own website from that directory.
I want to have one common directory for all users where I can put fonts, images and so on. If I create a dir outside the user-folder I get CORS (origin) errors.

How can I have a common folder for all users?

Re: User login with Mod_Rewrite and a common folder? Possibl

PostPosted: 24. December 2021 15:10
by Nobbie
1) Why dont you use mod_userdir instead of the Rewrite? See https://httpd.apache.org/docs/2.4/mod/mod_userdir.html
See also https://httpd.apache.org/docs/2.4/howto ... _html.html

2) If you use mod_userdir, you easily can use any folder for centralized data. Otherwise you can use ALIAS directive to define any folder outside of DocumentRoot for fonts and images.

Re: User login with Mod_Rewrite and a common folder? Possibl

PostPosted: 24. December 2021 16:12
by Richard Marell
Thank you. Alias did the job for me.