0

I'm trying to make my .htaccess work. My DirectoryIndex is index.html

I would like visitors to see index.html when they go to www.domain.com. I would also like index.php to work when visitors go to www.domain.com/index.php.

What it's happening is that visitors go to www.domain.com/index.php and they are redirected to www.domain.com so they see index.html . Is there a way to make www.domain.com/index.php to go to the index.php page instead of going to the root.

I tried RewriteCond %{THE_REQUEST} and RewriteCond %{REQUEST_URI} with no luck.

Thanks for your help! :)

1
  • 1
    Actually, your desired behaviour is the default. Look through the other config settings, if something interferes (most liekly RewriteRules). Commented Feb 7, 2011 at 16:16

1 Answer 1

1

Removing index.php from the list of DirectoryIndex directives (as you have done) should solve this ideally.

DirectoryIndex index.html
Sign up to request clarification or add additional context in comments.

4 Comments

Hi Adarsh, thanks for your answer. When I remove index.php from the DirectoryIndex and I go to index.php, the .htaccess loads index.html because it redirects to domain.com
Means something is preventing index.php from being taken out of the index files list.
I see, thanks... can I change that using .htaccess or I should contact my hosting company?
If the DirectoryIndex settings of the main httpd.conf allows for overrides using an AllowOverride directive, you should be able to change using .htaccess. Else, there is no other means but to contact your hosting company.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.