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
I have this live search which works perfect until a company name in my
The only thing in http://localhost/.htaccess is this: Options +FollowSymLinks Alias /1 /2 ...and I
i have this jquery $('.delete_step').live('click', function(e) { e.preventDefault(); var delete_location = 'http//<?php echo $_SERVER[SERVER_NAME];
I have the following code in ://localhost/.htaccess... AddType application/x-httpd-php5 .css .js RewriteEngine on RewriteRule
I have a website which in a DEV context has the URL localhost:8080/MySite and
http://localhost:50034/Admin/Delete/723 Always needs this parameter to perform the action, however, if you go to
i have two files:(localhost/template/) index.php template.php each time when i create an article(an article
I've got a localhost implementation of WordPress using xampplite for Windows. I'd like to

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.