Hi,
I have verified that mod_rewrite is enabled on my Apache 2.2 instance.
However, now I'm having a problem just serving pages using .htaccess
files. Following Rik's advice, my .htaccess file is as follows
RewriteEngine On
RewriteCond %{REQUEST_FILEN AME} -f
RewriteCond %{REQUEST_FILEN AME} !^accesscontrol .php
RewriteRule ^(.*)$ accesscontrol.p hp?file=$1&%{QU ERY_STRING} [NC,L]
Right now, my accesscontrol.p hp file only contains
<?php
header("HTTP/1.0 200 OK");
?>
But when I visit a php or html file in the directory with the .htaccess
file, I just get a blank browser screen and the page is not served. I
know the mod_rewrite module is working because I have successfully used
it. Any suggestions on what I'm doing wrong above?
Thanks, - 5 4836 la***********@z ipmail.com wrote:
Hi,
I have verified that mod_rewrite is enabled on my Apache 2.2 instance.
However, now I'm having a problem just serving pages using .htaccess
files. Following Rik's advice, my .htaccess file is as follows
RewriteEngine On
RewriteCond %{REQUEST_FILEN AME} -f
RewriteCond %{REQUEST_FILEN AME} !^accesscontrol .php
RewriteRule ^(.*)$ accesscontrol.p hp?file=$1&%{QU ERY_STRING} [NC,L]
Right now, my accesscontrol.p hp file only contains
<?php
header("HTTP/1.0 200 OK");
>>
But when I visit a php or html file in the directory with the
.htaccess file, I just get a blank browser screen and the page is not
served. I know the mod_rewrite module is working because I have
successfully used it. Any suggestions on what I'm doing wrong above?
A blank page may be served. A custom 404 document or indeed the page
requested will still have to be served, and will not automagically appear.
Try to check the header, livehttpheaders for Firfox or Fiddler for MSIE are
invaluable tools.
For instance, with you previous "HTTP/1/0 401 Unauthorised", the headers I
receive are:
HTTP/1.1 401 Unauthorized
Date: Fri, 27 Oct 2006 03:21:08 GMT
Server: Apache/2.2.2 (Win32) DAV/2 mod_ssl/2.2.2 OpenSSL/0.9.8b
mod_autoindex_c olor PHP/5.1.4
X-Powered-By: PHP/5.1.4
Content-Length: 24
Content-Type: text/html
But indeed, a blank page, because no error document is given.
In your accesscontrol you can either include your custom 401 document, or
serve the file after verification of the user.
--
Rik Wasmus
If data is POSTed to a PHP page (say form_response.p hp) and the request
is first intercepted by accesscontrol.p hp, if I determine that the user
is logged in and then have a line
include($reques ted_file) (as I believe was in your example)
will the POSTed request still be in tact for processing by
form_response.p hp?
Thanks for the help, - Dave
Rik wrote:
la***********@z ipmail.com wrote:
Hi,
I have verified that mod_rewrite is enabled on my Apache 2.2 instance.
However, now I'm having a problem just serving pages using .htaccess
files. Following Rik's advice, my .htaccess file is as follows
RewriteEngine On
RewriteCond %{REQUEST_FILEN AME} -f
RewriteCond %{REQUEST_FILEN AME} !^accesscontrol .php
RewriteRule ^(.*)$ accesscontrol.p hp?file=$1&%{QU ERY_STRING} [NC,L]
Right now, my accesscontrol.p hp file only contains
<?php
header("HTTP/1.0 200 OK");
>
But when I visit a php or html file in the directory with the
.htaccess file, I just get a blank browser screen and the page is not
served. I know the mod_rewrite module is working because I have
successfully used it. Any suggestions on what I'm doing wrong above?
A blank page may be served. A custom 404 document or indeed the page
requested will still have to be served, and will not automagically appear.
Try to check the header, livehttpheaders for Firfox or Fiddler for MSIE are
invaluable tools.
For instance, with you previous "HTTP/1/0 401 Unauthorised", the headers I
receive are:
HTTP/1.1 401 Unauthorized
Date: Fri, 27 Oct 2006 03:21:08 GMT
Server: Apache/2.2.2 (Win32) DAV/2 mod_ssl/2.2.2 OpenSSL/0.9.8b
mod_autoindex_c olor PHP/5.1.4
X-Powered-By: PHP/5.1.4
Content-Length: 24
Content-Type: text/html
But indeed, a blank page, because no error document is given.
In your accesscontrol you can either include your custom 401 document, or
serve the file after verification of the user.
--
Rik Wasmus
la***********@z ipmail.com wrote:
If data is POSTed to a PHP page (say form_response.p hp) and the
request
is first intercepted by accesscontrol.p hp, if I determine that the
user
is logged in and then have a line
include($reques ted_file) (as I believe was in your example)
will the POSTed request still be in tact for processing by
form_response.p hp?
Well, I simple test could have told you that, but yes, it will be available
(contrary to redirects done with header('Locatio n: etc..');, this
redirection is done internally in the webserver and will make the POST (and
COOKIE & FILES) available to the script).
Be sure though, that the file that is requested is indeed one of your
locally hosted trusted files.
--
Rik Wasmus
You have been so helpful. I must trouble you with one more question.
You had these lines in your accesscontrol.p hp file
$path = parse_url($_GET['file'],PHP_URL_PATH);
$file = dirname(__FILE_ _).'/'.$fake_url['path'];
But I'm getting the following errors ...
Notice: Use of undefined constant PHP_URL_PATH - assumed 'PHP_URL_PATH'
in /usr/local/apache2/htdocs/refillingstatio n/admin/accesscontrol.p hp
on line 14
Warning: parse_url() expects exactly 1 parameter, 2 given in
/usr/local/apache2/htdocs/refillingstatio n/admin/accesscontrol.p hp on
line 14
Notice: Undefined variable: fake_url in
/usr/local/apache2/htdocs/refillingstatio n/admin/accesscontrol.p hp on
line 15
What was the intent of what you were trying to do here?
Thanks, - Dave
Rik wrote:
la***********@z ipmail.com wrote:
If data is POSTed to a PHP page (say form_response.p hp) and the
request
is first intercepted by accesscontrol.p hp, if I determine that the
user
is logged in and then have a line
include($reques ted_file) (as I believe was in your example)
will the POSTed request still be in tact for processing by
form_response.p hp?
Well, I simple test could have told you that, but yes, it will be available
(contrary to redirects done with header('Locatio n: etc..');, this
redirection is done internally in the webserver and will make the POST (and
COOKIE & FILES) available to the script).
Be sure though, that the file that is requested is indeed one of your
locally hosted trusted files.
--
Rik Wasmus
la***********@z ipmail.com wrote:
You have been so helpful. I must trouble you with one more question.
You had these lines in your accesscontrol.p hp file
$path = parse_url($_GET['file'],PHP_URL_PATH);
$file = dirname(__FILE_ _).'/'.$fake_url['path'];
Please fix you topposting.
Further:forget that, that was temporary insanity, because I expected a
query-string in $_GET['file']. That is offcourse already taken care of in
the .htaccesss, so $file = dirname(__FILE_ _).'/'.$_GET['file'] should
replace above lines.
--
Rik Wasmus This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Westcoast Sheri |
last post by:
Hello. How do I do this:
If a visitor types in any number after my url, I want mod_rewrite to
convert it to my url/anotherpage.html?number=number_visitor_typed
Example:
http://www.mysite.com/12345678.html
would result in:
|
by: Support |
last post by:
Hello,
I am running RedHat & Apache. RedHat does not allow creating more
that 32000 subdirectories in one folder due to #defined constant
limitation in the core code.
I need to display 47000 directories on web page:
e.g. mydomain.com/andrew , mydomain.com/bill , etc. Each directory
contains .html/htm files and image files (*.jpg, *gif,...
|
by: Shabam |
last post by:
In Apache there's a pretty powerful module called mod_rewrite. Is there
anything like that in dot net?
|
by: joelbyrd |
last post by:
I have a people-networking type site in which each user has their own
profile page, with their user id encoded. So, for example, the web
address of their page might look like
"www.example.com/my_profile.php?user_id=fdjkhfh2489298hf298h3s0dhfxj".
I want the users to be able to choose their own web address that would
look like...
|
by: Hermann.Richter |
last post by:
I want to rewrite URLs like
http://domain/dir/file.php?var1=val1&var2=val2#anchor
to
http://domain/dir/file?var1=val1&var2=val2#anchor
In other words, I want to strip out the php extension
I tried putting in the .htaccess file the following:
| |
by: Susanne West |
last post by:
hi group.
i'm tackling a bigger project that will use mod_rewrite to patch
a series of urls into a master php-script. this script builds the
page framework that contains a series of elements that remain on
every page. only a center part (a <div>) is filled with different
contents, depending on how the page is called (= mode of the page)....
|
by: Dr. No |
last post by:
I am new to using mod_rewrite and am trying to rewrite a URL to pass values to
my script so that:
http://www.myclient.com/everything/animals/mammals/cats
is transformed into
http://www.myclient.com/index.php?nav=everything&nav=animals&nav=mammals@nav=cats
Specifically, I am looking for an n-ary solution to this problem. I know how to
|
by: =?ISO-8859-1?Q?=22=C1lvaro_G=2E_Vicario=22?= |
last post by:
With Apache's mod_rewrite module I can keep *.php files and load them as
*.html files:
# Make http//example.com/foo/bar.html load /home/site/foo/bar.php
RewriteEngine On
RewriteRule ^(.*)\.html$ $1.php
But, is there any elegant way to prevent direct access to
"http//example.com/foo/bar.php"? No matter the "L" flag, all *.html
requests...
|
by: Dale |
last post by:
again, i know this is OT...just move along to the next post if it bugs you.
:)
i had been trying to have this:
project.66.204.32.110
from the client browser, map to a virtual host where the document root would
be:
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |