View Full Version : Add-on domain modrewrite headache

11-01-2007, 03:42 PM
Hey there. I have a site at mydomain.com/folder, figured it would be easy to use an addon domain addon.com to send everyone to the same folder, and now i'm in modrewrite hell :rolleyes:

because all my links are in the from src/href=/folder/otherfolders/file.txt i got links such as addon.com/folder/otherfolders... which needed to be just addon.com/otherfolders... .

using this modrewrite rule has solved it somewhat:

RewriteEngine On
RewriteBase /
RewriteRule ^folder/(.*)$ /$1 [R=301,NC,L]

that removes the /folder from most links, but now i have php includes that aren't doing the same thing...

see http://www.immortalsoon.co.uk/pages/images/images.html

it was originally http://www.inaudible.co.uk/crimea/pages/images/images.html
using the code:

<?php include($_SERVER['DOCUMENT_ROOT'] . '/crimea/pages/header.php'); ?>
to include a header file from http://www.inaudible.co.uk/crimea/pages/header.php

now i'm just getting an error which says:

Warning: main(/home/inaueco/public_html/crimea/crimea/pages/header.php) [function.main]: failed to open stream: No such file or directory in /home/inaueco/public_html/crimea/pages/images/images.html on line 1

and the only thing i can see that's worng is the double /crimea/crimea/ and i have no idea how it got there or how to solve it.

any suggestions? thanks.

EDIT: ok changing

<?php include($_SERVER['DOCUMENT_ROOT'] . '/crimea/pages/header.php'); ?>


<?php include($_SERVER['DOCUMENT_ROOT'] . '/pages/header.php'); ?>

solves it, but doesn't make sense. should document_root should be picking up the actual file system root (/home/public_html/folders...) and yet it acts as if it's just going on the domain name. and either way should it not be altered by the modrewrite rule above?