.htaccess doesn't work from subdirectory

I'd like to let people put www.mysite.com/trial into a browser and get directed to www.mysite.com/trial.php. That is, I don't want to force them to put in www.mysite.com/trial.php.  

So I put a trial directory under the root directory with an index.html file and a .htaccess file that contains:

Redirect   /index.html http://www.mysite.com/trial.php

But this doesn’t redirect. You go right into trial/index.html page.

I can do .htaccess redirects ok if I put the .htaccess file in the root directory of the site, so I'm thinking that .htaccess doesn't work in a subdirectory.

Is this the case?

Thanks for any info.
Who is Participating?
PapertripConnect With a Mentor Commented:
Put this in your .htaccess file in /trial
DirectoryIndex trial.php

Open in new window

Or just change trial.php to index.php, which is probably already in the global DirectoryIndex
Or just change trial.php to index.php, which is probably already in the global DirectoryIndex

To be clear I meant rename the file trial.php to index.php
larsrohrConnect With a Mentor Commented:
Your .htaccess isn't quite right.
You aren't trying to match "/index.html" -- you should be trying to match "/trial/index.html":

Redirect   /trial/index.html http://www.mysite.com/trial.php

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

That is only going to work if the GET request has /index.html in it.
It works fine on my server.
Browser asks for "/trial"; server says Well, I have a directory by that name; my server's DirectoryIndex setting uses index.html, so it interprets this request as wanting "/trial/index.html"; and then .htaccess kicks in and the Redirect sends it to "/trial.php".
I stand corrected.
stevaAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.