Customer area
FR NL EN
Gigaweb Guide

Redirect to a folder

Did your CMS install its content in a subfolder rather than at the root of your site? Here's how to automatically redirect your visitors there.

It sometimes happens that your site's files are located in a subdirectory rather than directly in the httpdocs folder — this is common with a CMS like WordPress. By default, the index.php file at the root of httpdocs is what's displayed when someone visits your domain. If this file wasn't used to build the site, here's the simplest solution.

1
Open the index.php file located at the root of httpdocs.
2
Delete all of its content.
3
Add the following code, replacing the URL with your own:
<?php
header('Location: http://www.example.be/'); // browser redirect
?>

The header('Location: …') command automatically redirects your visitors to the address specified.

Using a relative path

Rather than a full URL, you can redirect to a relative path, for example Location: ./wordpress/. The ./ notation means “stay in the current folder” (the one containing index.php) then enter the specified subfolder. If it contains an index file, that opens automatically; otherwise, the folder's file listing is displayed.