How can an OVHcloud site serve a subfolder without showing it in the URL?

The Citead team, updated

In short. Use OVHcloud's documented host and URI conditions in .htaccess, with the site files in a subfolder of the declared root folder.

Definition: An OVHcloud hidden-subfolder rewrite uses Apache's mod_rewrite in a .htaccess file to map a domain request to files inside a subfolder. The OVHcloud example keeps the public address at http://domain.tld while the requested page is served from http://domain.tld/MyWebsite.

Key facts

  • OVHcloud's URL rewriting tutorial documents Apache mod_rewrite on shared hosting, one .htaccess file per folder or subfolder, and settings inherited by its subdirectories.
  • OVHcloud's multisite guide defines the domain's root folder as the target folder containing the website files and describes customizing its name in the Control Panel.
  • Apache's mod_rewrite reference documents RewriteRule as a regular-expression rule whose pattern in .htaccess context is matched against a partial path.

What rule does OVHcloud document?

The OVHcloud tutorial gives the following example. Replace domain.tld with the domain and MyWebsite with the subfolder name.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.tld
RewriteCond %{REQUEST_URI} !^/MyWebsite
RewriteRule ^(.*)$ /MyWebsite/

The first condition limits the rule to the named host. The second condition is negative: it prevents a request already beginning with /MyWebsite from being rewritten again. The rule then matches the remaining path and substitutes the subfolder URL path. OVHcloud says this makes the displayed address http://domain.tld even though the page called is http://domain.tld/MyWebsite.

The example has no [R] flag. Apache's mod_rewrite reference distinguishes URL rewriting from external redirection and says that a rewrite rule can lead to internal sub-processing or an external redirect. The browser-visible result described by OVHcloud is therefore the relevant test for this configuration.

Where should the root folder and .htaccess file be?

OVHcloud defines the root folder as the folder associated with the domain in the hosting configuration. The multisite guide says the folder is created in the hosting storage space and can be renamed through the Advanced configuration option when a website is added. OVHcloud also says that manually installed website files must be uploaded to the appropriate root folder.

The URL rewriting tutorial describes the subfolder case separately: the website files sit in a folder such as MyWebsite inside the declared root folder. It instructs you to edit the .htaccess file at the root of the directory containing the website. That file is the configuration file for the example above. OVHcloud limits one .htaccess file to each folder or subfolder, and its settings extend to child directories.

How does Apache interpret the conditions?

Apache's mod_rewrite reference says that a RewriteRule pattern in per-directory context, including .htaccess, is matched against only a partial path. It also states that the full URL path can be tested with %{REQUEST_URI} in a RewriteCond. These rules explain why the OVHcloud example tests /MyWebsite with REQUEST_URI, while the RewriteRule pattern is simply ^(.*)$.

The substitution starts with /. Apache documents that a substitution beginning with / in per-directory context is treated as a URL path. The tutorial's code therefore names the internal path that contains the website files.

FAQ

Does the condition prevent a rewrite loop?

Yes. The OVHcloud example uses a REQUEST_URI condition that rejects paths beginning with /MyWebsite, so the subfolder path produced by the rule does not meet both conditions on the next pass.

Does the rule change the root folder configured in the OVHcloud Control Panel?

No setting in the example changes the hosting panel. The OVHcloud multisite guide describes the Control Panel's root folder as the domain's declared target folder, while the rewrite points requests to the MyWebsite subfolder inside it.

What should I replace in the example?

Replace domain.tld with the domain tested by the HTTP_HOST condition and MyWebsite with the actual website subfolder. The tutorial identifies both values as placeholders.

Sources

  1. OVHcloud, "Tutorial - Rewrite the URL for accessing your website using mod_rewrite via the .htaccess file", 16 June 2026
  2. OVHcloud, "Hosting multiple websites on your Web Hosting plan", 25 September 2026
  3. Apache Software Foundation, "Apache Module mod_rewrite", 2026

Check how a page reads to answer engines. Open the GEO score analyzer

Test a page and see what to fix first

The analysis usually takes less than 10 seconds and needs no account.

400,000+ pages scored in the public benchmark