Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
![Reply](https://www.linuxquestions.org/questions/images/buttons/reply.gif) |
10-15-2010, 04:06 PM
|
#1
|
LQ Newbie
Registered: Aug 2010
Posts: 22
Rep:
|
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
|
|
|
10-15-2010, 04:18 PM
|
#2
|
Senior Member
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833
Rep: ![Reputation: 167](https://www.linuxquestions.org/questions/images/reputation/reputation_pos.gif)
|
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.
|
|
|
10-16-2010, 05:43 AM
|
#3
|
LQ Newbie
Registered: Aug 2010
Posts: 22
Original Poster
Rep:
|
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
|
|
|
10-16-2010, 05:43 AM
|
#4
|
LQ Newbie
Registered: Aug 2010
Posts: 22
Original Poster
Rep:
|
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
|
|
|
10-18-2010, 05:08 PM
|
#5
|
Senior Member
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833
Rep: ![Reputation: 167](https://www.linuxquestions.org/questions/images/reputation/reputation_pos.gif)
|
I would suggest trying relative paths, they should be relative to the web root they're defined under.
|
|
|
10-18-2010, 05:47 PM
|
#6
|
LQ Newbie
Registered: Aug 2010
Posts: 22
Original Poster
Rep:
|
Hi rweaver,
I'm not sure how relative paths work. Can you be more explicit please?
Thanks,
Adrien
|
|
|
01-31-2011, 02:45 PM
|
#7
|
LQ Newbie
Registered: Jan 2011
Posts: 2
Rep:
|
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.
|
|
|
All times are GMT -5. The time now is 04:07 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|