Redirecting from inner folder

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sherone
Forum Newbie
Posts: 3
Joined: Sat Oct 03, 2009 4:14 am

Redirecting from inner folder

Post by sherone »

Sorry for the newbie question.

I have created a website It includes more than 7000 pages and more than 200 inner folders.
I'm using simple including file(header.php, right.php, left.php, bottom.php, footer.php).
in all the 7000 pages bottom, right, left and footer.php is the same and I might update this part in future.

Now the problem is when I go to the inner folder I want to redirect the pages to root directory.
suppose I have folder named "A" and theres is some files like "file1.php", fle2.php.
I created the "file1.php" like this.

<?php
include("header.php");
include("left.php");
?>
Contents content content content

<?php
include("right.php");
include("footer.php");
?>

but when I click on the "aboutus" button in the "file1.php" its showing file not found. becuase my aboutus.php in the root directory not in the folder "A".

How will I solve this problem.

I want to use this redirection function all my 200 folders.

any advise suggestion would be appreciated.

Thanks
sherone
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: Redirecting from inner folder

Post by Darhazer »

Add <base> tag in your header :D
sherone
Forum Newbie
Posts: 3
Joined: Sat Oct 03, 2009 4:14 am

Re: Redirecting from inner folder

Post by sherone »

Can you clear it? how will add the base tag??
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: Redirecting from inner folder

Post by Darhazer »

It's just an HTML tag:

Code: Select all

<base href="http://yourdomain.com" />
In this way all your relative links will be relative to yourdomain.com and not to the current path, as yourdomain.com/A/
sherone
Forum Newbie
Posts: 3
Joined: Sat Oct 03, 2009 4:14 am

Re: Redirecting from inner folder

Post by sherone »

My applied this. but my style sheet not working with the base url tag.
Darhazer wrote:It's just an HTML tag:

Code: Select all

<base href="http://yourdomain.com" />
In this way all your relative links will be relative to yourdomain.com and not to the current path, as yourdomain.com/A/
Post Reply