[support] .htaccess question

Philip_Wetzel at nhd.uscourts.gov Philip_Wetzel at nhd.uscourts.gov
Wed Feb 12 16:51:24 UTC 2014


I like this example on how to create a module,,,,Simple as it gets.
http://cryptosmith.com/node/373

Phil



From:	"Metzler, David" <metzlerd at evergreen.edu>
To:	"support at drupal.org" <support at drupal.org>,
Date:	02/12/2014 11:32 AM
Subject:	Re: [support] .htaccess question
Sent by:	support-bounces at drupal.org



I think you would be happier if you did this as a drupal module (it really
is not that hard to do), than trying to hack the .htaccess file.   Also
drupal's .htaccess could be modified to point to your script rather
than .php.

Implementing a custom module is really straightforward for what you need:

Create a subfolder  in the sites/all/modules folder lets say
sites/all/modules/mymodule
Create a single .info file text file in that folder (mymodule.info) with
the following text:

name =  mymodule
core = 7.x

Then create a  mymodule.module file with a single function:
function mymodule_init() {
  // your code that should execute on every drupal page load goes here.
}

You can now enable this module in your drupal site and do what you need to
do.  As a general strategy, I'd recommend writing code that inspects for
session variables or cookies set by the other application and if it doesn't
find them  redirects to the url either with drupal_goto()  or with a header
set.   You can tell wether the drupal user is logged in by inspecting the
global variable $user and seeing if it has a uid property.





-----Original Message-----
From: support-bounces at drupal.org [mailto:support-bounces at drupal.org] On
Behalf Of Prothero William
Sent: Tuesday, February 11, 2014 4:41 PM
To: support at drupal.org
Subject: [support] .htaccess question
I have a php script that I wrote that will use Drupal to validate the user
login of a separate app that isn't part of Drupal. I have a php script that
I want to put within the Drupal site. I can't seem to make .htaccess
override the Drupal settings so that I can execute the php. Currently, I
have, in the folder that holds the php:

# disable directory browsing
Options All -Indexes
AddHandler cgi-script .php
AddType application/x-httpd-php .php
AddHandler application/x-httpd-php .php

What should I do to enable my php script to execute? I've set the
permissions to execute and I do get a listing of the php script file
contents, which is not what I want. How can I make it execute?

Bill

William Prothero
http://es.earthednet.org



--
[ Drupal support list | http://lists.drupal.org/ ]
--
[ Drupal support list | http://lists.drupal.org/ ]




More information about the support mailing list