View Full Version : Editing .htaccess to use PHP inside of HTML?
Brad Padgett
08-13-2014, 01:49 AM
I am hosting with Godaddy.
I need the correct coding to edit .htaccess for running PHP code inside of an HTML file (my homepage for instance).
For example, "AddType application" does not work.
Neither did "FCGIdWrapper" or "AddHandler" but I may have used the wrong variation.
I'm sure many of you have had to set this up at some point or another so the correct code for Apache 2.5 is highly appreciated.
Thank you so much.
- Bradley Padgett (thexboxcloud)
Lynne
08-13-2014, 01:53 AM
Why not just set the homepage as index.php instead of index.html?
I'm not sure if a lot of people have had to set up what you want as most would just set index.php as the default.
I don't know the .htaccess to do what you want, sorry.
Brad Padgett
08-13-2014, 02:48 AM
Why not just set the homepage as index.php instead of index.html?
I'm not sure if a lot of people have had to set up what you want as most would just set index.php as the default.
I don't know the .htaccess to do what you want, sorry.
If this happens to be Lynne Sands then I am in the right place. And thanks for directing me to vBulletin.org
I may name my vBulletin home page index.php but I also need to know for wordpress for a separate site I am working on for a buddy.
If I was to name it index.php as I have tried, the html code does not take affect. This is possible if you were to explain how I am supposed to get the page to work properly?
To save trouble, the correct .htaccess lines for Apache 2.5 would be perfect.
But if you have a real suggestion that may assist in my (even) creation of the homepage using index.php then I'm all ears. I am experienced in html and css but I haven't got started with my php schooling quite yet.
I will wait on your response.
Thank you a lot.
- Bradley Padgett (thexboxcloud)
Lynne
08-13-2014, 05:01 PM
If you have a file called index.html and you want to show it in index.php, I think your index.php file can just look like this:
<?php
readfile("/path/to/index.html");
?>
(I haven't tried that, but I think it would work.)
As I said before, I've never done what you want to do, but I did google it and found this - http://php.about.com/od/advancedphp/p/html_php.htm According to that, the line to add to your .htaccess file is:
AddType application/x-httpd-php .html
If that doesn't work, then are you sure your .htaccess file is working? Your host could have the server set up to not allow .htaccess files (they may have AllowOverride set to None instead of All).
Scanu
08-14-2014, 08:32 AM
Lynne I think that the op doesn't know how to use html and php in a php file
This is your html code
<?php
echo 'This is your php code';
?>
This is other html code
Brad Padgett
08-14-2014, 09:44 AM
Lynne I think that the op doesn't know how to use html and php in a php file
This is your html code
<?php
echo 'This is your php code';
?>
This is other html code
From reading I have heard of a similar method with doing the same thing inside of html files.
Like this:
<?php
echo '<p>text</p>';
echo '<h2>text</h2>';
?>
I intend to name my vBulletin homepage index.php
There are a couple other things I need to use the php for so I'm working with godaddy support right now to figure out how I'm going to get .htaccess to work on apache 2.5
I believe the php handler is FCGI. The support I've received with my webhost so far hasn't been of much help.
The link Lynne gave me is more directed towards another version of apache.
I've tried the method of using FCGIdWrapper and AddHandler. Still nothing.
A solution would evidently be impressive.
Scanu
08-14-2014, 09:59 AM
I'm still not sure why you don't want to use a .php file
In a .php file you can use html and php at the same time, why would you need to use php file in a .html file? I'm sorry but i don't fully understand what do you want
Brad Padgett
08-14-2014, 10:09 AM
I'm still not sure why you don't want to use a .php file
In a .php file you can use html and php at the same time, why would you need to use php file in a .html file? I'm sorry but i don't fully understand what do you want
The reason is I have another project going on.
I am designing a wordpress blog to implement a live feed and recent posts widget while still maintaining my index.html as this is all it's going to be.
I've made what I need to get done as clear as possible.
And please don't say I shouldn't ask here because it has to do with wordpress. I am confident it shouldn't matter. Really, I need to know for the purpose of using it anywhere but I could use the info for vBulletin too.
Apache 2.5 > .htaccess > lines for php inside of html
Pretty simple from there. I'll be checking back and forth so if anyone is used to .htaccess on sites like godaddy let me know. It's really been a pain.
Lynne
08-14-2014, 04:05 PM
Have you asked GoDaddy if you can use .htaccess on your site? Like I said previously, if .htaccess doesn't seem to be working, then they may have AllowOverride set to None instead of All.
Brad Padgett
08-15-2014, 01:09 AM
Have you asked GoDaddy if you can use .htaccess on your site? Like I said previously, if .htaccess doesn't seem to be working, then they may have AllowOverride set to None instead of All.
Yes, they said it was working.
I'm going to have to start using .php
So I'm going to have to learn how to do this. Apparently the method the other guy suggested is not working. I'll figure this out somehow.
Lynne
08-15-2014, 02:05 AM
If you post your code (if it's a bunch of html, then just the first and last few lines before your php code), then perhaps we can help. And, if you can provide us a link to view the problem, that helps (just put a page on your site called "test" with the content and link us to it).
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.