User login with Mod_Rewrite and a common folder? Possible

Problems with the Windows version of XAMPP, questions, comments, and anything related.

User login with Mod_Rewrite and a common folder? Possible

Postby Richard Marell » 24. December 2021 14:35

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?
Richard Marell
 
Posts: 6
Joined: 23. December 2021 19:21
XAMPP version: 7.3.12
Operating System: Windows

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

Postby Nobbie » 24. December 2021 15:10

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.
Nobbie
 
Posts: 13179
Joined: 09. March 2008 13:04

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

Postby Richard Marell » 24. December 2021 16:12

Thank you. Alias did the job for me.
Richard Marell
 
Posts: 6
Joined: 23. December 2021 19:21
XAMPP version: 7.3.12
Operating System: Windows


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 142 guests