I recently uploaded a PHP theme on my server. It's working fine on any other sections except my home page. For example, when accessing www.mywebsite.com/anything the theme is working but when on homepage www.mywebsite.com the server's default page is shown.

I was playing with the htacess RewriteEngine and it was working in some cases but probably not correct. This is what I have so far:

<IfModule mod_rewrite.c>
RewriteEngine on
Options -Multiviews
RewriteCond %{REQUEST_URI} !-d
RewriteCond %{REQUEST_URI} !-f
RewriteRule ^(.*)?$ index.php?a=$1  [QSA,NC,L]
ErrorDocument 404 /new/404.php

This is making my home page work, but the title is not showing it's saying "Page Not Found" on the title. The page is working and all I'm changing is the two RewriteCond above. They were set to {REQUEST_FILENAME} but that made my website homepage not work and show the default server page.

1 Answer 1


It isn't clear in your question if the correct PHP files are being hit. Assuming the syntax of your .htaccess is correct:

Your RewriteRule is indicating your index.php as the receiver for any files and directories that do not exist, with the path (I believe) being sent to $_GET['a']... it is up to your index.php to detect and handle this appropriately.

ErrorDocument is a separate mechanism and once again, if the 404.php is being hit it is up to it to e.g. header('HTTP/1.1 404 File Not Found') and then output HTML that indicates a page not found.

  • this is what i have found in my index.php <?php include("includes/htaccessConfig.php"); $app = new App(); $app->run(); ?>
    – Nedi
    Apr 5, 2016 at 21:21
  • So this is an application someone else wrote? Which application is it? Is there any documentation on how to accomplish this redirect?
    – Keilaron
    Apr 6, 2016 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.