WebSite X5Help Center

 
Arnold Page
Arnold Page
User

Blog comments not processed when DirectoryIndex set to blog/index.php  en

Autor: Arnold Page
Visitado 2278, Followers 2, Compartido 0  

This is a supplement to my post 'Standalone blog - or blog as home page' which Paul M. and KolAsim handled. It relates to my website www.naturalhealthdiet.uk.

When I set the website's default page to blog/index.php by adding an .htaccess file that said 'DirectoryIndex blog/index.php' & 'Options -Indexes' and then tried to submit a comment to a blog post, an error message said, 'The requested URL /index.php was not found on this server.'

So I added another .htaccess file to the 'admin' folder, which said 'DirectoryIndex index.php', both with and without the second line 'Options -Indexes', and the same error message appeared. I also tried 'DirectoryIndex index.php' only in the 'admin' folder but without the 'Options -Indexes' line in the .htaccess file in the root folder. The error message again appeared when I tried to submit a comment.

Can anyone help, please?

Publicado en
3 RESPUESTAS - 1 CORRECTO
Paul M.
Paul M.
Moderator

Hello again Arnold,

In like manner to the previous issue this new problem has to do with the fact that the WebSite X5 blog scripts are set to execute within the 'blog' directory and not the 'root' directory.  So we will need to write some code to overcome this.

Please place the following lines of PHP code 'Before closing the HTML tag' in the 'Expert' tab of the Blog 'Properties' (Step 2 Sitemap):

<?php
if ($_SERVER['REQUEST_URI'] == '/')
{header('Location: /blog/index.php'); exit();}
?>

This solution also negates the need to adjust the link to the blog CSS file, so the line that we added last time can now be removed:

i.e. delete <link rel="stylesheet" type="text/css" href="http://www.naturalhealthdiet.uk/blog/style.css" />

Please also remove the extra .htaccess files and DirectoryIndex instructions which you created, as these are not required and will cause problems.

Let us know how this works out for you.

Kind regards,

Paul

Leer más
Publicado en de Paul M.
Paul M.
Paul M.
Moderator

Screenshot attached illustrating exactly where to put the new code...

Leer más
Publicado en de Paul M.
Arnold Page
Arnold Page
User
Autor

Thank you Paul. It all seems to be working properly now.

Leer más
Publicado en de Arnold Page