Trouble with mod_rewrite and PHP Extensions - Help Making the Correct .htaccess File
Posted
by
nicorellius
on Server Fault
See other posts from Server Fault
or by nicorellius
Published on 2012-10-29T19:32:42Z
Indexed on
2012/10/29
23:04 UTC
Read the original article
Hit count: 168
I'm looking for a set of simple rules and redirects for my site. I've tried so many combinations that I'm starting to get confused.
I'm not sure how to set this up. Generally, without mod-rewrite, I would use relative paths to link to files:
<a href="link.php">Link</a>
if it's in the same directory.
Now I'd like to use this:
<a href="link">Link</a>
And so if you go to this page:
localhost/mysite/link
it will take you to the correct place, which would be:
localhost/mysite/link.php
But also, many directory levels deep I would like it to work as well:
localhost/mysite/group/link2
would go to:
localhost/mysite/group/link2.php
and:
localhost/mysite/group/section/link3
would go to:
localhost/mysite/group/section/link3.php
But then in all these cases, if someone were to type in this:
localhost/mysite/group/section/link3.php
in the URL bar, it would show this:
localhost/mysite/group/section/link3
Thanks
© Server Fault or respective owner