Since adding an .htaccess file my index page is not loading?


I’m building a website and it’s been working out well until I added an .htaccess file to clean up the url… Unfortunately it seems that messed up my homepage. Both my localhost and the online version is messed up, as you can see (the website is currently live)

The page it lands at is not identical to the page I call “home” which is the index.php file. The landing page is supposed to look like this one:

I need it to land on index.php automatically.

My .htaccess file only consisted of this and nothing more:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [NC,L]

Please assist…Driving me nuts. I already checked a ton of answers on SO and around the web but nothing seems to help my problem.

I deleted the .htaccess file and nothing changed. I just need to know what I should do to restore whatever there was before I added this file. How come even deleting the .htaccess file did not work?

Right so your first link does go to the index.php page anyway so is the problem that you want “Home” to be highlighted?

If so just modify the script. I believe this is doing the highlight:

function highlightPage() {
		if (!$("#navigation")) return false;
		var nav = $("#navigation");
		var links = nav.find("a");
		for (var i=0; i<links.length; i++) {
			var linkurl = links[i].getAttribute("href");
			var currenturl = window.location.href;
			if (currenturl.indexOf(linkurl) != -1) {
			links[i].className = "here";

So either set the “Home” to always have the “here” class and remove it if you are on any other page or put another test case where you read the text of the link and add the css class based on that.

Thanks for replying Johnny. The way I see it’s not going to index.php, because each page’s body-tag has an ID identical to the file name. And since I am using #index in the stylesheet to style the contents on homepage, the styles only pick up in index.php. The styles don’t pick up on the landing page, whichever page that is… It’s strange because it’s grabbing the html content from index.php but it’s not grabbing the styles associated with the id #index.

Also, clicking on “Home” from the homepage should go to itself right? If it doesn’t, it means the current page isn’t actually called index.php

Not sure if I’m explaining it properly, but I hope it’s clear enough to make you understand.

So can you explain the difference between the landing page and index.php because to me they are the same file.

The difference is that the landing page’s filename is not index.php
If it was, then it would have no trouble applying the CSS associated with the ID #index { css-rules }
Isn’t that correct?

I believe that web servers in general treat index.php as the home page. Therefore if you go to the site root you do not need to add /index.php or whatever to get to the home page.
I see nothing in that .htaccess file to change this behaviour.