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 6352273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:10:16+00:00 2026-05-24T22:10:16+00:00

On my localhost and live website I have different .htaccess directives like this one:

  • 0

On my localhost and live website I have different .htaccess directives like this one:

AuthUserFile /path/to/folder/.htpasswd

Is there a way to dynamically indicate the root directory in the .htaccess file so that I don’t need to have different .htaccess files for local vs live hosts?

  • 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-24T22:10:17+00:00Added an answer on May 24, 2026 at 10:10 pm

    From: http://httpd.apache.org/docs/2.2/en/mod/mod_authn_file.html#authuserfile :

    File-path is the path to the user file. If it is not absolute, it is
    treated as relative to the ServerRoot.

    So one of the solution is to use a relative path. You should use something like ../auth/.htpasswd with the auth directory outside of your web root (so here for example if the .htaccess is on your web root).

    PS: %{DOCUMENT_ROOT} is only a mod_rewrite variable AFAIK, so you do not have it for AuthUserFile instruction

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a local URL like http://localhost:port/ with live video stream in it.
I have installed drupal on my localmachine(ubuntu, Xampp), at localhost. Path and Pathauto modules
How can I translate an URL like: http://localhost/mySite/?link=OFFERS&sublink=ARTICLE&subsublink=DETAIL to: http://localhost/mySite/OFFERS/ARTICLE/DETAIL if one parameter is
I've moved my live website drupal to windows localhost(xammp), but I'm getting lots of
I have a website which in a DEV context has the URL localhost:8080/MySite and
i have designed a website. it is now live with http://innovakota.6te.net I have used
file://localhost/C:/Users/kürşat/Desktop/yeni%20site/faq%20-%20Kopya/kopya.html this is my photography tutorial page. I'm did manage to toggle on/off when
i have two files:(localhost/template/) index.php template.php each time when i create an article(an article
I'm making a website in c# .NET and using the windows live id web
I have written a app in PHP on my localhost server using XAMP, which

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.