Jump to content

[SOLVED] Removing the extension..


Michdd

Recommended Posts

I've been trying to figure out how to do this for a while, not constantly but here and there trying to get it to work. I've failed all times.

 

You see it on some websites where the .php is removed from the file name. I've done some research and found that you can do this with a .htaccess file (knew this for a while now). However whenever I try it doesn't work. I'm using an apache server; I'm wondering if there is something else I have to change to get this to work? Am I putting the file in the right location? I tried putting it in my main root folder like a normal .htaccess file.. no luck.. One example of contents I've tried is:

 

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php [L,QSA]

Link to comment
Share on other sites

Does it work on any file other than index.php?

 

Maybe you have a directory called index?

No I don't and it doesn't work for any files.

When I do it, I do this:

 

Options +FollowSymlinks
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /$1.php [L,QSA]

 

That doesn't work either, again could it be that I have the port in my url?: http://domain.com:port/index

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.