wordpressapacheovh

Base path of my website redirect to Index Of


My website is a Wordpress and it seems to be available only at https://arch-doc.com/www

My configuration on OVH is enter image description here

On the base path, it show us the Index Of webpage.

Any advice to handle this issue?


Solution

  • Your web root contains nothing that tells the server what to render, so it falls back on indexing the folder's content. What we need to change this is a .htaccess-file in this directory with rules to rewrite the request to the subdirectory. There's a article from the WordPress documentation that covers this use case and that I'm working from.

    Here's the content of the .htaccess-file you would put into your web root:

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www.)?arch-doc.com$
    RewriteCond %{REQUEST_URI} !^/www/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /www/$1
    RewriteCond %{HTTP_HOST} ^(www.)?arch-doc.com$
    RewriteRule ^(/)?$ www/index.php [L]
    </IfModule>
    

    This should be it. Just refresh your browser (ctrl-F5, to clear your cache just to be safe :) ) and you should be golden.