Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
Hi,

Problem:

I have a httpd.conf file for one of our sites - it reads:-


Code
DocumentRoot /home/httpd/vhosts/domain.com/httpdocs<br />ServerName www.domain.com<br />ServerAlias www.domain.com domain.com www.domain.net domain.net<br />RewriteEngine on<br />RewriteCond %{HTTP_HOST}                !^123.124.125.126(:80)?$<br />RewriteCond %{HTTP_HOST}                !^www.domain.com(:80)?$<br />RewriteRule ^/(.*)                      http://www.domain.com/$1 [L,R]<br />RewriteOptions inherit<br />


It actually is more complicated than this, and includes various rewrites.

Now everything works (including all the rewrites), except for one thing - shtml files will not display the includes.

These includes simply say

<!--#include virtual="/common/includes/logo_strap_ad.inc" -->

for example.

All the redirects work, but when when I take it down to the basics as in the example code above, the includes fail to display. The remainder of the page works fine.

Remove the code from the httpd.conf and the includes display, so it must be connected with the piece of code above.

Any thoughts from anyone?


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Sponsored Links
Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
To permit SSI on your server, you must have the following directive either in your httpd.conf file, or in a .htaccess file:
Code
<br />        Options +Includes<br />

This tells Apache that you want to permit files to be parsed for SSI directives. Note that most configurations contain multiple Options directives that can override each other. You will probably need to apply the Options to the specific directory where you want SSI enabled in order to assure that it gets evaluated last.

Not just any file is parsed for SSI directives. You have to tell Apache which files should be parsed. There are two ways to do this. You can tell Apache to parse any file with a particular file extension, such as .shtml, with the following directives:
Code
<br />        AddType text/html .shtml<br />        AddHandler server-parsed .shtml<br />

Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
Hi Jeremy,

All that exists - if I remove the code above, and not allow other URL's to automatically redirect to the main one - then the includes work fine in the .shtml file.

If I am not using shtml files then all the pages will work quite happily - it is purely the includes that fail - no errors, just that the include command is in the source file, and is not passed in any shape. PHP pages, scripts everything else is quite happy

Other SHTML pages on other sites work fine.





Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
The only way around it at the moment is to change all the pages to php - and replace the include with

<? include("/var/www/vhosts/domain.com/httpdocs/common/includes/file_to_include.inc"); ?>

This works, but puzzled as to why the shtml will no longer work though.


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Feb 2002
Posts: 1,759
Addict
Addict
Offline
Joined: Feb 2002
Posts: 1,759
Hmm.. odd

What flavor and version of linux?

Sponsored Links
Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
RH 7.3


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Feb 2002
Posts: 2,286
Veteran
Veteran
Joined: Feb 2002
Posts: 2,286
I think I will have to switch all pages to php - probably not a bad idea in the long run. Only snag then is finding a way to redirect folks from shtml pages to php, especially when not all pages will have been cut over straight away.

Did find a very old script to do this, that is based around a custom 404 page, but it fails to work

Code
 <script type="text/javascript"><br />    oldURL = window.document.location + "";<br />    if (oldURL.search(/shtml/i) > 0) {<br />        newURL = oldURL.replace(/shtml/i, "php");<br />        document.write("This page has moved.");<br />        document.write("The new URL is: ");<br />        document.write("<a href=\"" + newURL);<br />        document.write("\" title=\"new location\">");<br />        document.write(newURL + "</a>");<br />        window.location.replace(newURL);<br />    }<br /></script><br /> 


Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)
Joined: Oct 2000
Posts: 2,223
Veteran
Veteran
Offline
Joined: Oct 2000
Posts: 2,223
Can you post all of the mod rewrite rules?

What you have there doesn't say anything to me any more if the requested http host is your .com or .net or IP address take the URL and rewrite it to the .com.

moreover, what is in this file?

/common/includes/logo_strap_ad.inc



Picture perfect penmanship here.
Joined: May 2003
Posts: 8
Newbie
Newbie
Offline
Joined: May 2003
Posts: 8
[]Jeremy said:
To permit SSI on your server...[/]

You can also use FilesMatch in .htaccess or httpd.conf to enable SSI, which replaces the need for "AddType text/html .shtml" and "AddHandler server-parsed .shtml" in the conf.

<FilesMatch "\.shtml$">
SetHandler server-parsed
</FilesMatch>


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
badfrog
badfrog
somewhere on the coast of Maine
Posts: 94
Joined: March 2007
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240506)