FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


.htaccess - removing extensions





eday2010
I found several scripts on how to remove the .php file extension from my pages. They all seem to work only in the root directory. When I try to get to a page within another directory, I either get a 403 Forbidden error, or with the following code

Code:
Options +FollowSymLinks
Options +Indexes
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.php [NC,L]


I get a directory listing instead of the page. Will removing the extension work if I have a page and directory with the same name? For instance, inside a directory called Gallery, I have a file called static.php, and a folder called static, which contains all the files the php page uses.

Is this what is causing both my problems? Is there a way around it without changing the directory or page names?

EDIT: That was indeed the problem. Changing the folder names fixed the problem. Scratch this post.
erlendhg
It's good that you found the solution to your problem Smile
(I have also experienced many times that I have posted a problem, and just afterwards found the solution).

I just wondered, don't you also want to use
Code:
RewriteCond %{SCRIPT_FILENAME} !-f
so that you don't rewrite a request for an exisiting file? Or don't you want that?
Related topics
change the WHM skeleton
htaccess Password Protection
.htaccess tutorial
CANT UPLOAD .htaccess, .htpasswd, .header, .footer
I have a problem....Mozilla Firefox
[tutor] How to protect images without htaccess using PHP
.htaccess IP Blocking
Custom error pages using .htaccess
frontpage?
A Question For .htaccess
How can I...
Frontpage Ext. Problems!!
.htaccess
I realise the irrelivance..
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.