[PHP] htaccess question
I know it's not a php question, but I can't readily find the answer elsewhere. I want to make this directive universal. Put htaccess file on any host in any folder. This works RewriteEngine On RewriteCond %{SERVER_PORT} !=443 RewriteRule ^(.*)$ https://www.foo.org/bar/$1 [R=301,L] #Here the foo.org and /bar must be specified I want what is in effect RewriteRule ^(.*)$ https://{host_name}/{directory}/$1 [R=301,L] I can easily do this with php regex capturing the (host and dir) and then rewriting the text string; but the Apache directives are not obvious. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] htaccess question
On Tue, Apr 9, 2013 at 2:07 PM, Al n...@ridersite.org wrote: I know it's not a php question, but I can't readily find the answer elsewhere. I want to make this directive universal. Put htaccess file on any host in any folder. This works RewriteEngine On RewriteCond %{SERVER_PORT} !=443 RewriteRule ^(.*)$ https://www.foo.org/bar/$1 [R=301,L] #Here the foo.org and /bar must be specified I want what is in effect RewriteRule ^(.*)$ https://{host_name}/{directory}/$1 [R=301,L] I can easily do this with php regex capturing the (host and dir) and then rewriting the text string; but the Apache directives are not obvious. You were on the right track: RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] htaccess question
How can I prevent access to all files in a directory except one with an htaccess file. I've tried several approaches found with Googling; but, none seem to work. e.g., FilesMatch ^(makeScodeImg.php) Order Allow,Deny Deny from all /FilesMatch This seems to me as it should deny to all except makeScodeImg.php Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] htaccess question
First turn your ReWriteEngine On. This can be done in the particular folder to allow them access to only the one file. You need to understand the conditions of mod_rewrite read below. http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html OR you can just use the http://cooletips.de/htaccess/ from Germany. It will take you through step by step in creating an htaccess. I might suggest you do not use the password options because that to me is not safe to use someone else's website when creating htaccess screen names and passwords. Richard L. Buskirk -Original Message- From: Al [mailto:n...@ridersite.org] Sent: Monday, May 23, 2011 11:53 AM To: php-general@lists.php.net Subject: [PHP] htaccess question How can I prevent access to all files in a directory except one with an htaccess file. I've tried several approaches found with Googling; but, none seem to work. e.g., FilesMatch ^(makeScodeImg.php) Order Allow,Deny Deny from all /FilesMatch This seems to me as it should deny to all except makeScodeImg.php Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] htaccess question
On Mon, May 23, 2011 at 11:52 AM, Al n...@ridersite.org wrote: How can I prevent access to all files in a directory except one with an htaccess file. I've tried several approaches found with Googling; but, none seem to work. e.g., FilesMatch ^(makeScodeImg.php) Order Allow,Deny Deny from all /FilesMatch This seems to me as it should deny to all except makeScodeImg.php Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Also don't forget to enable override on the directory, otherwise .htaccess wont be read at all... http://httpd.apache.org/docs/2.0/mod/core.html -- The trouble with programmers is that you can never tell what a programmer is doing until it’s too late. ~Seymour Cray
[PHP] htaccess question
I want to restrict access to all files except one on my site and in parent dir. Thought this should work; but it doesn't. Files * Order Deny,Allow Deny from all Allow from xx.36.2.215 /Files xx.36.2.215 is actual value IP This file makes a captcha image and is called with img src=makeScodeImg.php alt=missing img file / in file /dir/control.php makeScodeImg.php is= /dir/includes/makeScodeImg.php Works fine if allow all just for testing Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] htaccess question
Hi gang: Is there a way I can use a htaccess directive to require a php script to be included within each file contained within that directory? For example, let's say I have a directory with 100 scripts in it, but I want each script within that directory to pass through an authorization script before executing. The hard way is for me to go through each of the 100 scripts and add the statement require(auth.php), but I don't want to do that (I'm too lazy and beside there is too great of a chance of an error). So, is there a way for me to circumvent this problem by using a htaccess directive? Now, I know that I can use htaccess to require basic authorization, like so: AuthType Basic AuthName admin AuthUserFile /home/httpd/vhosts/mydomain.com/.htpass require valid-user But I don't want a file containing user ids and encrypted passwords in the file system. Instead, I want to move the user ids and passwords into the database and out of the file system. I can do this with an authorization script, but I don't want to alter 100 scripts to do it. Opinions and suggestions welcomed. Thanks, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] htaccess question
Is there a way I can use a htaccess directive to require a php script to be included within each file contained within that directory? For example, let's say I have a directory with 100 scripts in it, but I want each script within that directory to pass through an authorization script before executing. The hard way is for me to go through each of the 100 scripts and add the statement require(auth.php), but I don't want to do that (I'm too lazy and beside there is too great of a chance of an error). So, is there a way for me to circumvent this problem by using a htaccess directive? I don't think it is possible to include a particular script for every request without using include or require statements. You can solve this problem by routing all the request to one file, say index.php and then manipulate the flow from there. -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] htaccess question
On Fri, Sep 11, 2009 at 4:46 PM, tedd t...@sperling.com wrote: Hi gang: Is there a way I can use a htaccess directive to require a php script to be included within each file contained within that directory? For example, let's say I have a directory with 100 scripts in it, but I want each script within that directory to pass through an authorization script before executing. The hard way is for me to go through each of the 100 scripts and add the statement require(auth.php), but I don't want to do that (I'm too lazy and beside there is too great of a chance of an error). So, is there a way for me to circumvent this problem by using a htaccess directive? Now, I know that I can use htaccess to require basic authorization, like so: AuthType Basic AuthName admin AuthUserFile /home/httpd/vhosts/mydomain.com/.htpass require valid-user But I don't want a file containing user ids and encrypted passwords in the file system. Instead, I want to move the user ids and passwords into the database and out of the file system. I can do this with an authorization script, but I don't want to alter 100 scripts to do it. Here is a link to the manual. http://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file *PHP_INI_PERDIR* Entry can be set in php.ini, .htaccess or httpd.conf Opinions and suggestions welcomed. Thanks, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] .htaccess question protect my php test environment
I have to apologies about this posting in advance so please don't flame me too bad for being off topic. Question: I want to create an .htaccess file to protect my files I did the passwrd -c /directory/file frank the set a password and then confirmed the password I created a .htaccess file with vi and put this in it. AuthName restricted stuff AuthType Basic AuthUserFile /var/password/frank require valid-user then in the redhat http server utitily under server settings I went tot he virtual directory section and created a new virtual dir called virtual 0 and check marked the box at the bottom for .htaccess protection. I restart the server and then go to another computer and put in the URL and no password box comes up. :( __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] .htaccess question protect my php test environment
Hi, It's htpasswd and not passwd. As many others on this group i don't use the redhat config system it's lame. You will be better off editing httpd.conf and adding an AllowOverrides directive. best regards Frank Tudor wrote: I have to apologies about this posting in advance so please don't flame me too bad for being off topic. Question: I want to create an .htaccess file to protect my files I did the passwrd -c /directory/file frank the set a password and then confirmed the password I created a .htaccess file with vi and put this in it. AuthName restricted stuff AuthType Basic AuthUserFile /var/password/frank require valid-user then in the redhat http server utitily under server settings I went tot he virtual directory section and created a new virtual dir called virtual 0 and check marked the box at the bottom for .htaccess protection. I restart the server and then go to another computer and put in the URL and no password box comes up. :( __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha/megaupload/ Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] .htaccess question protect my php test environment
Frank Tudor wrote: I have to apologies about this posting in advance so please don't flame me too bad for being off topic. Question: I want to create an .htaccess file to protect my files I did the passwrd -c /directory/file frank The above is wrong, the below is right htpasswd -c /path/to/file username the set a password and then confirmed the password I created a .htaccess file with vi and put this in it. AuthName restricted stuff AuthType Basic AuthUserFile /var/password/frank require valid-user then in the redhat http server utitily under server settings I went tot he virtual directory section and created a new virtual dir called virtual 0 and check marked the box at the bottom for .htaccess protection. I restart the server and then go to another computer and put in the URL and no password box comes up. :( Make sure you are allowing enough override for .htaccess to work. Can't help with the GUI...never used one. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] .htaccess question protect my php test environment
Frank Tudor wrote: John, Sorry I did use htpasswd... Override? Do you have a snip from a config file that I can look at? I don't mind editing the httpd.conf manually. Frank This controls which options the .htaccess files in directories can override. Can also be All, or any combination of Options, FileInfo, AuthConfig, and Limit Directory /path/to/directory AllowOverride All /Directory -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] htaccess question
Hi, i installed Apache, PHP and mySQL on winNT. I am trying to get htaccess files to work. I created a .htaccess file in a directory with this line in it: errordocument 404 /404.php I changed the httpd.conf file for apache and restarted apache like this: # AllowOverride None AllowOverride All But when I enter a url that doesn't exist I get this error in the browser: Not found The requested URL /peter personal/applications development/generic/htdocs/subfolder/dfdfdf was not found on this server. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request. What is a good way to check if htaccess files are working, and what can I do to get them to work? Thanks for any ideas, hints, ...! Peter ~~ http://liga1.com building multiple language/culture websites http://poorbuthappy.editthispage.com online ethnology, updown -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] htaccess question
Also, I am trying to find a way to get this to work: within the directory I'm in, 1/5/2/3 should be rewritten to index.php?a=1b=5c=2d=3 I'm sure lots of people have done this before, but the Apache examples don't seem to include this. Where can I find a working example? Thanks! Peter Hi, i installed Apache, PHP and mySQL on winNT. I am trying to get htaccess files to work. I created a .htaccess file in a directory with this line in it: errordocument 404 /404.php I changed the httpd.conf file for apache and restarted apache like this: # AllowOverride None AllowOverride All But when I enter a url that doesn't exist I get this error in the browser: Not found The requested URL /peter personal/applications development/generic/htdocs/subfolder/dfdfdf was not found on this server. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request. What is a good way to check if htaccess files are working, and what can I do to get them to work? Thanks for any ideas, hints, ...! Peter ~~ http://liga1.com building multiple language/culture websites http://poorbuthappy.editthispage.com online ethnology, updown -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] ~~ http://liga1.com building multiple language/culture websites http://poorbuthappy.editthispage.com online ethnology, updown -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] .htaccess question
At 06:57 PM 3/22/01 +0100, Jimmy Bckstrm wrote: Yo! I need to know how I create a login script that uses the htaccess file to authenticate users. Thankful for any answers! /Broder B Set up your .htaccess file as usual, pointing to a userfile created with htpasswd. Place the .htaccess file in the directory with your PHP script(s), and users will be automatically prompted for username/password before being served any file in that directory (at least the first time during that session, anyway). Within your PHP script(s), you can determine the user by reading the REMOTE_USER http environment variable: $user = getenv("REMOTE_USER"); - Brian - Brian S. Dunworth Sr. Software Development Engineer Oracle Database Administrator The Printing House, Ltd. (850) 875-1500 x225 [EMAIL PROTECTED] - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]