Using .html pages to run .php
Moderator: General Moderators
Using .html pages to run .php
Hi guys,
I realize I must just be missing some simple thing to get this to work because from everything I've read it's not hard.
Ok I have http://gods-heros-myth.com/godpages/bellerophon.php all built with different php menus and such and it works great! However, I can not have all of my pages rename to .php and still expect to keep my search engine rankings.
So I've been told I still keep my extensions as .html and edit a .htaccess file to have the .html pages run the .php code. Well no matter what I do...this page does not run the php code http://gods-heros-myth.com/godpages/bellerophon.html You'll see at the bottom the footer isn't running.
I dragged the .htaccess file off of my server and edited to be this:
AddType application/x-httpd-php .php .htm .html
I saved it and uploaded it into the root, the directory of my menus, and the directory of my .html page. No luck...
There is a .nsconfig file in the root of my main directory as well, but I do not know what that does.
What am I doing wrong??
Thanks!!
I realize I must just be missing some simple thing to get this to work because from everything I've read it's not hard.
Ok I have http://gods-heros-myth.com/godpages/bellerophon.php all built with different php menus and such and it works great! However, I can not have all of my pages rename to .php and still expect to keep my search engine rankings.
So I've been told I still keep my extensions as .html and edit a .htaccess file to have the .html pages run the .php code. Well no matter what I do...this page does not run the php code http://gods-heros-myth.com/godpages/bellerophon.html You'll see at the bottom the footer isn't running.
I dragged the .htaccess file off of my server and edited to be this:
AddType application/x-httpd-php .php .htm .html
I saved it and uploaded it into the root, the directory of my menus, and the directory of my .html page. No luck...
There is a .nsconfig file in the root of my main directory as well, but I do not know what that does.
What am I doing wrong??
Thanks!!
this is the last line of the code i saw when i looked at the link you posted,<script language="php"> include("../menus/footer.php");</script>
i`ve never had this style of coding work and not sure if that would work on anything other than an ms server? (i have no idea really!!!)
depending on your server config this wont work, instead try using
Code: Select all
<? include("../menus/footer.php"); ?>Code: Select all
<?php include("../menus/footer.php"); ?>Simon<script language="php"> include("../menus/footer.php");</script>
Not seen that before myself, but i have just tried in on my server (apache) and it worked no problemSimon.T wrote:this is the last line of the code i saw when i looked at the link you posted,<script language="php"> include("../menus/footer.php");</script>
i`ve never had this style of coding work and not sure if that would work on anything other than an ms server? (i have no idea really!!!)
Simon
This may help
http://fundisom.com/phparadise/php/html ... HP_in_HTML
http://fundisom.com/phparadise/php/html ... HP_in_HTML
AddType application/x-httpd-php .html .htm
I'm able to drag .htaccess off of my server, change it and then upload it...no problems so I will try the above.
WIth regards to the coding, it's not standard php, honestly I used it as a cut and paste from another website I'm cleaning up as a quick test. It works just fine on .php strings, but the problem above is a pain.
I can not afford to rename my pages to .php and lose my rankings. I'll let you guys know, thanks a lot
WIth regards to the coding, it's not standard php, honestly I used it as a cut and paste from another website I'm cleaning up as a quick test. It works just fine on .php strings, but the problem above is a pain.
I can not afford to rename my pages to .php and lose my rankings. I'll let you guys know, thanks a lot
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
It's just basic POSIX regex. mod_rewrite support must be compiled into apache before you do anything else. phpinfo() would show if that's the case or notnikkib20 wrote:Anyone know how to do the mod method above?
In a .htaccess you'd simply do (untested)
Code: Select all
RewriteEngine On
RewriteBase /
RewriteRule ^([a-zA-Z0-9_]+)\.html(.*)$ $1.php$2I thought he said he didn't have htaccess access, either that or I misunderstood and he just cannot change the default handlers (I think this might be what he meant)
put that in an htaccess file, and if you don't get a 500 error then you should be good to go, to test it make a hello_world.php and type yourdomain.com/hello_world.html. All it's doing is making the URL look like a html
d11 - you can't access the query string like that
I use something like that usually, it rewirtes "search?q=test" to "search.php?q=test"
Code: Select all
RewriteEngine On
RewriteRule *\.html $1.phpd11 - you can't access the query string like that
Code: Select all
# Search script
RewriteCond %{QUERY_STRING} q=(.*)
RewriteRule ^search$ search.php?q=%1 [L]-
vincenzobar
- Forum Commoner
- Posts: 95
- Joined: Wed Nov 02, 2005 9:57 am