Is there a way to get this by .htaccess file?

n my site root directory. there are donghua.php and index.php. now, is there a way to use .htaccess file to let the visitor access my site .the default shows example.com/donghua.php. not example.com/index.php. thank you. the server is Apache.

ps:The user still can access example.com/index.php

i using

DirectoryIndex donghua.php 

in the .htaccess. the default page is ok. but when i access example.com/index.php it redirect to example.com/donghua.php. if i forbid it redirect how do i do?

So… the problem is that index.php redirects to donghua.php, but you don’t want that to happen?

If that’s your question, then we’re going to need more information. Either one of your other htaccess rules is causing the redirect, or something in index.php is causing the redirect. We can’t check either one unless you show them to us.

when access the site(http://www.example.com). i want it shows the content(http://www.example.com/donghua.php). and when i access [B]http://www.example.com/index.php[/B] directly, it also work.

Is this what you want to happen when these URI are called:

  1. http://www.example.com/” goes to “http://www.example.com/donhua.php

  2. http://www.example.com/donhua.php” goes to “http://www.example.com/donhua.php

  3. http://www.example.com/index.php” goes to WHERE EXACTLY

yes, you are right. http://www.example.com/index.php go to http://www.example.com/index.php

Why not follow standard practise and make items one and three activate index.pup and donhua.php to go to a separate page?

in donghua.php i invoke a flash. so i want to when the user access the site it will show the flash. there is a link on the flash. (enter the site)example.com/index.php

I have searched and unable to find a .htaccess solution to your problem.

Can you post a link to your site and other posters may be able to help.

http://www.hf-cgp.com/donghua.php

i want to access the site(http://www.hf-cgp.com/) shows the flash http://www.hf-cgp.com/donghua.php . then click enter the site(at bottom of the site.) the site is made by wordpress.

Why not have a splash screen with two links:

http://johns-jokes.com/downloads/sp-b/donhua/

Hi,

Create a .htaccess file in the root of your website and add this line to it:

DirectoryIndex donhua.php

This should do what you want.

this made you can’t access example.com/index.php. when your access it will redirect to example.com/donghua.php

how to make when the user open the site. it shows http://johns-jokes.com/downloads/sp-b/donhua/

Just modified the link:

  1. No .htaccess required
  2. index.php now has source displayed at the bottom of the page
  3. index.php has two buttons, one links to the donhua.php the other to a new index_main.php
  4. index.php now loads very quickly

That’s weird, it shouldn’t!
Try clearing your cache to ensure that your browser hasn’t cached a previous redirect.

Here’s an example demonstrating that it does work.

I created a directory entitled “directoryIndex-example”
In this directory I placed three files, “index.php”, “donhua.php” and a .htaccess file.
The .htaccess file contained this:

DirectoryIndex donhua.php

Now, if you go to the following url, you are directed to donhua.php
http://hibbard.eu/blog/pages/directoryIndex-example/

However, if you navigate to either file directly, then things still work as expected:
http://hibbard.eu/blog/pages/directoryIndex-example/index.php
http://hibbard.eu/blog/pages/directoryIndex-example/donhua.php

Saying all of that, I find John’s solution much better, as it gives your visitors a choice in what they look at.
Also, remember that iOS devices don’t support Flash.