Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7399251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:02:11+00:00 2026-05-29T04:02:11+00:00

I have an .htaccess file that authenticates users against LDAP using mod_auth_ldap . My

  • 0

I have an .htaccess file that authenticates users against LDAP using mod_auth_ldap. My requirement is to somehow store their username and use it elsewhere**. I think I may be able to do it with mod_rewrite and cookies.

AuthBasicProvider ldap
AuthType Basic
AuthName "xxx"
AuthzLDAPAuthoritative off

AuthLDAPUrl "xxx" NONE
AuthLDAPBindDN "xx"
AuthLDAPBindPassword xx

Require valid-user

—

RewriteCond %{HTTP_COOKIE} !(username)
RewriteRule ^(.*)$ - [L,CO=username:%{USERNAME}:.domain.com]

If anyone wants to tell me cookies is a rubbish idea and has a better one, please do.

Many thanks.

** I note there are security implications by using a username from a cookie but in my app this acceptable.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T04:02:12+00:00Added an answer on May 29, 2026 at 4:02 am

    The magic variable was %{REMOTE_USER}.

    RewriteEngine on
    RewriteCond %{HTTP_COOKIE} !username
    RewriteRule ^(.*)$ - [L,CO=username:%{REMOTE_USER}:.domain.com]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an .htaccess file that's using several rewrite rules. These rules aren't working
I have an htaccess file that uses mod_rewrite to redirect /controller to /index.php?controller=%controller% Like
I have created an .htaccess files that will prevent anyone from accessing a file
I have been toying with http authentication using the .htaccess file in an attempt
I have an .htaccess file that is not working properly. And it used to.
I have the following code for my .htaccess file that I've picked up from
I am new to URL rewriting and I have an .htaccess file that looks
So I already have my .htaccess file configured so that when I load the
We have need for creative htaccess file: when user enters file that exists -
I would like to have one .htaccess file that can rewrite correctly on both

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.