LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-15-2010, 04:06 PM   #1
ahingert
LQ Newbie
 
Registered: Aug 2010
Posts: 22

Rep: Reputation: 0
Local and remote paths on .htaccess


Hi,
As many developers probably do, I have a Windows based machine on which I run XAMPP locally to test my code and a Linux machine with Fedora as my remote server.

As I sometimes use .htaccess as a way to authenticate some parts of the website, I end up having two .htaccess files: one with the local path (something line D:\My_Webs\) and one with my remote path (something like /var/www/html/) to the password file.

I have searched high and low, but I cannot seem to find any trick so that I only have to maintain one version of the .htaccess file which can work on both Linux and on Windows machines.

Has anybody found a solution to this?


Thanks,
Adrien
 
Old 10-15-2010, 04:18 PM   #2
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
If you could post an example file with the difference, it would make it easier to determine what you're doing and how to best go about it exactly. That being said in some cases you can specify both and since only one will apply that works... With authentication you might be able to get away with relative paths for the related files. Post up an example and it'll be easier to give ya a hand.

(Edit: non-absolute paths are treated as relative to server root... /var/www/html and D:\my_webs\ for example... )

Last edited by rweaver; 10-15-2010 at 04:20 PM.
 
Old 10-16-2010, 05:43 AM   #3
ahingert
LQ Newbie
 
Registered: Aug 2010
Posts: 22

Original Poster
Rep: Reputation: 0
Ok, so on my local XAMPP installation I have something like this in my .htaccess file:
Code:
AuthType	basic
AuthName 	"super secret area!"
AuthUserFile	D:\My_Webs\.htpasswd
require 	valid-user
While on my remote server the .htaccess file would be something like
Code:
AuthType	basic
AuthName 	"super secret area!"
AuthUserFile	/var/www/html/.htpasswd
require 	valid-user
Is there any way that the AuthUserFile path could be the same on both files, maybe using relative paths, or...?



Thanks,
Adrien
 
Old 10-16-2010, 05:43 AM   #4
ahingert
LQ Newbie
 
Registered: Aug 2010
Posts: 22

Original Poster
Rep: Reputation: 0
Ok, so on my local XAMPP installation I have something like this in my .htaccess file:
Code:
AuthType	basic
AuthName 	"super secret area!"
AuthUserFile	D:\My_Webs\.htpasswd
require 	valid-user
While on my remote server the .htaccess file would be something like
Code:
AuthType	basic
AuthName 	"super secret area!"
AuthUserFile	/var/www/html/.htpasswd
require 	valid-user
Is there any way that the AuthUserFile path could be the same on both files, maybe using relative paths, or...?



Thanks,
Adrien
 
Old 10-18-2010, 05:08 PM   #5
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
I would suggest trying relative paths, they should be relative to the web root they're defined under.
 
Old 10-18-2010, 05:47 PM   #6
ahingert
LQ Newbie
 
Registered: Aug 2010
Posts: 22

Original Poster
Rep: Reputation: 0
Hi rweaver,
I'm not sure how relative paths work. Can you be more explicit please?


Thanks,
Adrien
 
Old 01-31-2011, 02:45 PM   #7
mrbraco
LQ Newbie
 
Registered: Jan 2011
Posts: 2

Rep: Reputation: 0
Arrow

I am looking the same thing but in a different way, i got my file:
Code:
AuthType Basic
AuthName "Members Only"
AuthUserFile /home/site/public_html/subdom/priv/data/.htpasswd
AuthGroupFile /home/site/public_html/subdom/priv/data/.htgroup
Require valid-user
but i am looking to ACCESS FROM REMOTE server for membership site with something like this:
Code:
AuthType Basic
AuthName "Members Only"
AuthUserFile http://domain.com/subdom/priv/data/.htpasswd
AuthGroupFile http://domain.com/subdom/priv/data/.htgroup
Require valid-user
or this:
Code:
AuthType Basic
AuthName "Members Only"
AuthUserFile http://subdom.domain.com/priv/data/.htpasswd
AuthGroupFile http://subdom.domain.com/priv/data/.htgroup
Require valid-user
Does anybody knows if this is do-able ?
thank you.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to rsync from remote to local dooley28 Linux - Software 1 09-23-2010 02:03 AM
clamd upgradation in remote mach through local mac by script to be run on local mach Narayandutt Programming 3 11-29-2006 11:00 AM
shell script to compare filese b/w local and remote and delete files from local serve dsids Linux - Networking 9 08-23-2006 08:20 AM
Remote Mounting? (Mount remote folder on local filesystem) mac_phil Linux - Networking 1 11-15-2003 04:48 PM
Automatically resolving WINDOWS paths to pre-configured Linux paths gazzy Linux - General 1 09-05-2003 11:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration