Welcome to dbFreaks.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Is it possible to use PHP variables in .htaccess?

 
   Database Help (Home) -> PHP RSS
Next:  How can I eliminate blank rows in record on a for..  
Author Message
George

External


Since: Oct 12, 2008
Posts: 1



(Msg. 1) Posted: Sat Oct 11, 2008 10:25 pm
Post subject: Is it possible to use PHP variables in .htaccess?
Archived from groups: alt>comp>lang>php (more info?)

Dear All,

I am doing some testing among multiple servers and I need to have a rule
in my .htaccess file that looks like the following:

php_value include_path path1

However, the value path1 will change as the file will be uploaded to a
number of different servers - I would like to have a variable doing the
work rather than me changing the value manually?

Is there a trick for that? I tried

php_value include_path $_SERVER['DOCUMENT_ROOT']

but it failed miserably.

Many Thanks,
George

 >> Stay informed about: Is it possible to use PHP variables in .htaccess? 
Back to top
Login to vote
Tim Greer

External


Since: Oct 01, 2008
Posts: 29



(Msg. 2) Posted: Tue Oct 14, 2008 3:20 pm
Post subject: Re: Is it possible to use PHP variables in .htaccess? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

George wrote:

> Dear All,
>
> I am doing some testing among multiple servers and I need to have a
> rule in my .htaccess file that looks like the following:
>
> php_value include_path path1
>
> However, the value path1 will change as the file will be uploaded to a
> number of different servers - I would like to have a variable doing
> the work rather than me changing the value manually?
>
> Is there a trick for that? I tried
>
> php_value include_path $_SERVER['DOCUMENT_ROOT']
>
> but it failed miserably.
>
> Many Thanks,
> George

When you say it failed miserably, can you elaborate? Are you getting an
Internal Server Error (500 error), or is it just not working as
expected? Are you getting any errors? Some variables can be declared
in php.ini or .htaccess locally to your account, and some demand to be
in the global php.ini and can't be overriden locally. Some need to be
in the script or are better put in the script. Also, keep in mind that
it depends on the server's configuration.

If they (the web host) use the Apache API for PHP, then, if they
allow .htaccess control files, it can work with a php_flag or
php_value, depending, and some will use suPHP or a similar wrapper
which dictates you use a local php.ini (if you are allowed to). This
should be an easy and common setting, but it depends on your web host
and how they built PHP and what options you're allowed to set, or if
you need to put it in the actual PHP script source itself.
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!

 >> Stay informed about: Is it possible to use PHP variables in .htaccess? 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Redirect with .htaccess - I am trying to fix a problem where Google has indexed the wrong version of a URL. I need to redirect the bad version to the good version with 301 redirects. I've tried a couple of things, but it's not working. The bad URLs look like this:..

php and .htaccess - hi, i wanted to check if that certain url is active or not, and ive used fopen, file_get_content()..however these functions didnt worked out because allow_url_open to our webserver is set to off. someone recommended that i can modify it or achieve the....

.htaccess and mod_rewrite - is there a way that I can make my own file extension and have it load as php? from this: example.com/something.php to this: example.com/something.extension

function call in .htaccess ? - Hi, I use something like this: RewriteRule ^(.*).png$ ../../templates/png_help/$1.png The links to png in my pages exist to this subdir, but in fact the png are located somewhere else in a templates directory. Now, I'm shuffeling folder..

SEO URL Htaccess - Hai, I want to convert my smarty urls to seo friendlly.For example index.php?mod=member&pg=user&act=list should be converted to mod/ member/pg/user/act/list Url can have N number of querystrings. All of those should be converted to seo friendly...
   Database Help (Home) -> PHP All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]