Yes, I've read the Apache manual and searched here. For some reason I simply cannot get this to work. The closest I've come is having it remove the extension, but it points back to the root directory. I want this to just work in the directory that contains the .htaccess
file.
I need to do three things with the .htaccess
file.
I need it to remove the .php
a. I have several pages that use tabs and the URL looks like page.php#tab - is this possible?
b. I have one page that uses a session ID appended to the URL to make sure you came from the right place, www.domain.com/download-software.php?abcdefg
.
Is this possible? Also in doing this, do I need to remove ".php" from the links in my header nav include file? Should IE "<a href="support.php">support</a>" be <a href="support">support</a>?
domain.com
, but www.domain.com/page
.I'll keep looking, trying, etc. Would being in a sub directory cause any issues?
Gumbo's answer in the Stack Overflow question How to hide the .html extension with Apache mod_rewrite should work fine.
Re 1) Change the .html to .php
Re a.) Yup, that's possible, just add #tab
to the URL.
Re b.) That's possible using QSA
(Query String Append), see below.
This should also work in a sub-directory path:
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [QSA,L]